Earlier today I was pondering the fact that I needed some new business cards when I had a sudden brain storm. A sort of a metarecursive brainstorm, really. I could picture the design I wanted. But first I’d need some help from Steve Hoelzer.... read more >>
]]>Who’s Steve Hoelzer? Why he’s the genius behind the MATLAB Annoyatron, but what I’m really interested in is his Droste Effect tool. I could search for it on the File Exchange, but right now I want to take you for a stroll through MATLAB’s AddOn Explorer. Because amazingly enough, you can find Steve’s Droste tool from right inside the heart of a living MATLAB. Not only that, you can install it with one click.
So let’s say you’re using MATLAB and you get a hankering for some Droste magic. On MATLAB’s Home tab, select “Get AddOns”.
This will open the AddOn Explorer. Incidentally, they’re called “AddOns” because you can add things not only from the File Exchange, but also MathWorks products, like toolboxes and blocksets. Right now we’ll search for the term “droste” and see what that turns up.
Bingo! There’s the file we’re looking for. Click on it so we can learn some more about it. It looks like it’s worth installing. Notice that under the Add button, I can click once and add it to my MATLAB. The AddOn Explorer is also showing me that I’ll need the Image Processing Toolbox in order for this tool to work properly. If I don’t have that toolbox installed, the AddOn Explorer can even guide me through the process of getting a trial.
I add the file to MATLAB, and immediately I’m able to run the code. So here is the effect I’m after: the Droste effect occurs when an image recursively includes itself. Here is the sample image supplied by Steve.
And now you can see my new business card.
If at some point in the future I wanted to remove the Droste Effect tool, I could go up to the AddOn Manager like so.
There I am presented with a list of my current AddOns, any one of which I can uninstall.
The AddOn manager opens up a new window on the File Exchange. Discover, add, and manage your files directly from inside MATLAB.
]]>One summer when I was in high school I spent a lot of time playing pingpong at a summer camp. Between games, I would watch this guy named Rob play Defender on a nearby console. Rob had godlike Defender skills, and he was always playing. I can still picture the... read more >>
]]>Fast forward many years, and video game voyeurism is a big business. It’s now clear that lots of people like watching other people play video games. Sometimes people like watching an expert do a speed run or a narrated walkthrough, but often they just enjoy watching someone else play a new game for the first time. These “Let’s Play” videos show you how a gamer thinks about a game, how they solve problems in real time. You can learn a lot, in addition to being entertained.
Programming can work the same way. It can be very instructive to watch a skilled programmer solve a problem. I like how you get exposed to work habits and tacit knowledge that are hard to learn other ways (“Ah, so that’s where I should press F10 to dbstep”). So we have Let’s Code videos to go along with our Let’s Play videos. I made a short one once, but Stuart McGarrity does much better than that.
Here in the MathWorks Consolidated Blog Operations Business Park, my office is one building over from Stuart’s (a short ride away on the BlogTram). Stuart is the keeper of the MATLAB Videos blog, and he’s been making a number of these Code Along videos. I particularly like the series he did on solving Cody problems, but he’s got dozens of them. If you’ve ever needed a MATLAB script to compare two long lists of strings from Excel, then you might enjoy Making a MATLAB Script to Compare Two Long Lists of Strings from Excel. But you might enjoy it even if you have never once needed a MATLAB script to compare two long lists of strings from Excel. That’s the nature of these videos. Watch a few and see what you learn.
Finally we get to the title of this post: What is on Stuart’s table? Stuart shoots his videos in his office, and every video features an unusual object on the table to his right. I haven’t figured out a pattern yet, but I’m sure there must be one.
Why would the heart cupcake appear on March 24th and the leprechaun on January 5th?
What are we to make of the crown, the chair, and the Playmobil concert?
Your guess is as good as mine. Ask Stuart in his comments area.
]]>Have you tried ThingSpeak yet? It’s cool, it’s free, and it talks to MATLAB. I like all three of those things. Let me show you how it works.... read more >>
]]>ThingSpeak is called an “Internet of Things platform”. You can use it to collect data from internetconnected devices, analyze it, plot it, and then use it to kick off some other event. So, for example, you could have a sensor that measures the tide in Ockway Bay and then makes a nice chart and maybe even tweets when the water is deep enough for you to go boating.
I’m going to use ThingSpeak to sense the environment, but not something as exotic as the tides around Cape Cod. My environment is a web page that shows how many solutions have been submitted to Cody. My sensor is a screenscraping function that grabs the right number from the page.
My ultimate goal is to make an automatically updated MATLAB plot that shows me the number of new Cody solutions that have come in every day for the past 60 days. To do this, I’m going to use four different ThingSpeak services:
Here’s how it all fits together
Once a day, the TimeControl app will kick off a MATLAB Analysis app to grab the number of Cody solutions. I’ll take that number and save it to a ThingSpeak channel. Associated with that channel, I’ll have a MATLAB Visualization app that does some further analysis and turns it into a pretty plot.
The Cody Solutions page has the number of solutions displayed in the upper right. I use the urlfilter command to grab that number and then push it to the ThingSpeak channel.
Here’s the code that runs every day on ThingSpeak.
My channel (number 217011) comes with a nice default chart.
I can see that the number is very big and steadily rising. That’s great, but it’s hard to see much detail here. What I’d really like is a plot of the number of solutions submitted per day. This is where the MATLAB Visualization app comes in handy. I want to read in the data and then put it into a timetable. This makes it easy for me to resample it once every day. Once I do this, I can feel confident that the time interval I get when I take the elementbyelement difference is always exactly 24 hours. I can plot this daily difference and then include, for good measure, a seven day moving average to wash out any weekly artifacts. All in a handful of lines of code. Look:
And finally, here is the plot I’ve been working toward.
Every day we get between 400 and 900 new solutions on Cody. And now I can see that there was a marked rise in the number of solutions submitted in midFebruary. I wonder why? That’s a question for another day. For now I want to close by pointing out that all this was free and based on the latest version of MATLAB. From now until the day I shut down this channel, I will have this automatically generated plot of uptodate Cody statistics. Thanks ThingSpeak!
]]>
Last month we collaborated with Luke Rendell and Elena Miu of St Andrews University on a programming contest (hosted at CumulusContest.org). This contest was modeled on our old MATLAB programming contest.... read more >>
]]>My job was to come up with a challenge. Here it is: take a chain and coil it on the floor of a box. For instance, suppose I gave you this chain. Each link, or bead, is drawn a different size to indicate that it has a different weight.
Your job is to place the chain in the box compactly; that is, with the heavy bits bunched in the middle as much as possible. Even so, the chain must lie in a single plane and snake through the box using only straight segments or 90 degree turns.
Here’s an example built with MATLAB code. How would you arrange this chain?
You can see easily enough that we want to put the heaviest weight right in the middle. So the optimal weight distribution looks like this.
But now suppose you were given this chain. It’s the same weights, but in a different order.
The optimal weight distribution is the same, but the snaking path of the chain is different.
So you get the basic idea. But the problem gets much harder to solve as the chain gets longer. Given this chain, how would you write an algorithm to fold it quickly and efficiently?
Here’s what the winner of the contest generated. Not bad!
It’s a fiendish problem. Participants of the contest couldn’t afford to test their answers exhaustively. For one thing, combinatorics being what they are, there isn’t enough time in the universe to be completely exhaustive. For another thing, we gave them only 50 seconds to solve more than 100 of these problems.
I’m so impressed with the people who coded up solutions. Not just solutions, but lots of them, and lots of good ones. And they’re all available for your inspection on the site. Here is a plot of all the entries. There were 1148 total entries, of which 841 passed and received scores. Among these passing entries were 89 leaders.
That red line running along the bottom goes through each of the leaders. The algorithms started out small, but they grew as the contest progressed. Here’s a plot of code size over time.
I’ll finish with an animation of an especially entertaining kind of chain: a collection of equal weights separated by long empty stretches of cable. It made for some beautiful mazelike results. Here’s the starting chain. How would you cluster those beads in the middle?
Below is an animation of the results achieved by 24 different leading algorithms. I’m not showing all the leaders because many of them were speed improvements that didn’t change the layout of the chain.
Stay tuned… I understand the folks at St Andrews want to run more contests! When they do, I’m sure they’ll announce it over on their CumulusContest site.
And as always, thanks to everyone who played!
]]>As we move into 2017, lets take a look back at 2016. Here are the most popular files on File Exchange in 2016 based on downloads.... read more >>
]]>____________  ________________________________________________________________________ 

MATLAB Support Package for Arduino Hardware 

____________  ________________________________________________________________________ 
iPod Scramble Solution 

____________  ________________________________________________________________________ 
ANFIS Training using Evolutionary Algorithms and Metaheuristics 

____________  ________________________________________________________________________ 
MATLAB Support for the MinGWw64 C/C++ Compiler from TDMGCC 

____________  ________________________________________________________________________ 
Simulink Support Package for Arduino Hardware 

____________  ________________________________________________________________________ 
export_fig 

____________  ________________________________________________________________________ 
Legacy MATLAB and Simulink Support for Arduino 

____________  ________________________________________________________________________ 
Viewer3D 

____________  ________________________________________________________________________ 
Mcode LaTeX Package 

____________  ________________________________________________________________________ 
matlab2tikz/matlab2tikz 

____________  ________________________________________________________________________ 
Follow these links if you would like to view the most popular files in previous years
]]>Some of you will remember a semiannual programming contest that we ran here from 1999 to 2012. Some of you participated in it! Each contest ran for a week, and the contestants had to solve an optimization problem in MATLAB. There are a lot of programming contests out there, but the... read more >>
]]>I am delighted to report that the spirit of our old contest is alive. The MATLAB Programming Contest is being revived by researchers at the University of St Andrews in Scotland. Dr. Luke Rendell and a doctoral candidate in his group, Elena Miu, are researchers in the School of Biology with an interest in how culture evolves. They write, “If you decide to take part in our study, we’ll be using your submissions to investigate how the code changes over time and explore the interaction between innovation, sharing, and collective improvements.”
Think about that for a second. Your code will be the slime in the petri dish, and real live biologists will record how it mutates and spawns, scribbling in their field notebooks as you fiddle with your algorithm.
Look! It sprouted a secondary routine for spline reticulation! And the sparse diagonalization method has atrophied and decayed into a withered stump. Apparently it’s being colonized by some sort of simplex optimizer or… is that NelderMead? No, it’s a Krylov subspace method. Goodness me! Where did that come from? That’s a rare variant in these latitudes, probably blown off course by a sabbatical.
I can’t wait to read the resulting paper.
But seriously, the nature of networked collaborative innovation is poorly understood. This contest makes a perfect observational test bed. Here’s your chance to have fun and assist cognitive science at the same time. Who knows? You might show up as a particularly clever anonymized data point in the Proceedings of the Royal Society. But I can’t make any promises. The only thing I can say for sure is: you can’t win if you don’t play.
Here are some details. You can find the contest here: Cumulus Contest. St Andrews runs the site, while MathWorks provides the computational horsepower on the back end. We also helped with the problem definition. I think it should be an especially fun one. The contest doesn’t start until next Monday, 13 February, but you can sign up right away. Good luck, and we’ll see you in the queue!
]]>Here is a place I want to visit.... read more >>
]]>
Image credit: Jody Kingzett
It’s the new mathematics gallery (known as Mathematics: The Winton Gallery) at the Science Museum in London. See that Handley Page biplane floating in the middle of the room? Everything in the gallery is modeled and placed according to the simulated airflow around that plane. Isn’t that cool? Check out this video to see what I mean.
I’m happy to report that MathWorks is a major sponsor of this exhibit, and I’m even happier to make space here for Dr. David Rooney to tell you about the gallery. Dr. Rooney is ideally positioned to do so because he is in fact the Keeper of Technologies and Engineering at the Science Museum, and lead curator of the gallery. Take it away, Dr. Rooney…
by Dr. David Rooney
In December 2016, the Science Museum opened its bold new permanent exhibition, Mathematics: The Winton Gallery. Designed by Zaha Hadid Architects and occupying a 900 square metre space at the heart of the Museum, this new gallery showcases ways in which mathematical practice has underpinned everything we care about – from life and death to war and peace, money, trade, beauty and our attempts to control nature’s most elemental forces.
Visitors are faced with an astonishingly diverse array of historical artefacts. Some, such as the 1929 experimental biplane suspended at the heart of the room, seem an unusual choice for inclusion in a mathematics gallery. Discovering the mathematical story behind such exhibits offers new insights into the ubiquity of mathematics in today’s world. But other items on show immediately reveal their mathematical significance.
Taking pride of place in the gallery is one of the most significant objects in the history of computing: the trial assembly of Charles Babbage’s analytical engine, a generalpurpose Victorian computing machine that would, if finished, have been the size of a small railway locomotive. Alongside it sits a copy of MATLAB 1.3, dating from 1985. Together, the two artefacts tell a remarkable story of the ways computing technologies have changed the world over the last 175 years – and continue to do so today.
Trial portion of Charles Babbage’s analytical engine, 1834–71
Image credit: Science Museum, London
MATLAB disk and manual, 1985
Image credit: Science Museum, London
All computers, at their heart, are very fast calculators. They perform simple operations on the numerical digits ‘one’ and ‘zero’ very quickly and in huge quantities. But fast calculators, whilst important, would not have changed the world. A crucial intellectual concept underpinned the analytical engine. The power of modern computers rests on the concept that numbers can represent other things – in fact, anything we choose.
This conceptual leap, that calculators gain enormous power if the numbers they manipulate are symbolic of other things, was made in the nineteenth century by Ada Lovelace. In 1843, she published an account articulating the analytical engine’s possibilities as a generalpurpose computing device. In her description, she explained that the engine could do more than manipulate numbers as quantities. It could become a machine where numbers represented abstract items such as symbols or musical notes.
Lovelace’s insight came to mean that computing machines could in theory be programmed to model pretty much anything we wish – including those which are difficult to realise in reality. This is often the realm of pure mathematicians, whose work can be as much akin to philosophy as to science. Such mathematicians imagine abstract mathematical worlds, and increasingly use powerful computers to handle and test the models they think up. In doing so, they are searching for patterns and structure that might help us understand the universe.
This is where MATLAB comes in. Today, mathematicians have access not only to incredibly powerful computing technologies, but also to software that enables the most abstract ideas as well as realworld problems to be modelled and manipulated. The original digital computers required great skill and expertise to programme. Nowadays, packages such as MATLAB, first released in the 1980s, let mathematical practitioners in all walks of life grapple with the toughest mathematical ideas.
Mathematics: The Winton Gallery opened on 8 December 2016 and is free to enter. For further information visit sciencemuseum.org.uk/mathematics.
]]>If you’re a Cody player, you’re familiar with the What Now? problem. That is, you’ve got a few minutes to play around with Cody, but you’re not sure what to tackle next. We’ll always offer you the default display: problems you haven’t solved sorted by which ones have the most... read more >>
]]>That’s why we’re building more Problem Groups. In November I wrote about how Grant Cook III has been helping with challenge creation. Today I want to introduce another special challenge: the R2016b Feature Challenge. This particular challenge is interesting because it’s made up of problems that lend themselves to solutions with new features, features that were introduced in our R2016b release. So, for example, there are some problems that involve strings and some that involve timetables.
You’re always welcome to solve the problems however you like. You don’t have to apply the new features. But I guarantee there’s no better way to learn the value of new features than writing code to solve a real problem. And although I’m biased, I think there’s no more fun and motivating way to practice coding than Cody. Spend a few minutes with these problems and you’ll come away with handson experience of the value of these new features. That’s better than you’ll do scanning through release notes.
So here it is: the R2016b Feature Challenge.
Here’s a fun footnote to this challenge. We added it a few weeks ago, and we were pleased to see champion solver Peng Liu add a few of his own! So this challenge is a combined MathWorkscommunity effort. Thanks Peng! Why not start with his problem 43663: Combine the first and last names.
And finally, I want to point out one more way that you can learn about new problems to solve. You may have even noticed it already. We added a list of Suggested Problems to the page you see after you solve a problem. It sits on the right side of the page as shown here.
So there you have it. Two new ways to find interesting problems in Cody: a new features challenge and suggested problems List after every new solution. Now you know what to try next.
Oh, right. Did I forget to mention that you get a nice badge for completing the challenge? As of this writing, only four people have received it. Your turn!
]]>Until I deleted it this afternoon, the following tag appeared on one of the entries in the File Exchange: “can u plz send me the entire project report on my email address”. That’s all one tag. I can’t remember which file I deleted it from, but it hardly matters. It... read more >>
]]>Tags, as you probably know, are meant to be words or short word phrases that describe an item. We use tags on the File Exchange, Answers, and Cody. They can be very helpful when you want to move around in a set of related content. For instance, two people might give similar files very different names. One might be called “Solar Position” and the other one “Sun Tracking”. Based on only these titles, no single search will find both files, even though somebody interested in one of these is probably interested in both. But now suppose I come along and add the tags astronomy and solar to both of them. I’ve added value to our little community of MATLABbased sun enthusiasts, because now one search WILL find both files (since tags are included in the search index).
That’s the big idea behind tags: extra words to make search work better. And you can always click on the tag directly to find all other items with the same tag. One of the important things about tags is that anyone, not just the author, can add them.
But now I need to tell you about Souza’s Law.
Souza’s Law, named for Randy Souza, the MathWorks developer who first pointed it out to me, states that any text area will eventually be used for posing technical support questions. That is, if you can type into it, one day somebody will put in a question about how to use the “print depsc” command option for a resolution of 300 DPI. Even if the text box was labeled “Surname.”
As a concrete example of Souza’s Law, here is a list of actual File Exchange tags that I cleaned up recently. They all start with “can”.
It’s our job here at MATLAB Central to make sure the site is easy to use, so we need to think about ways to make it clearer what tagging is and how to use it effectively. But I just couldn’t resist showing you this amazing demonstration of Souza’s Law. Now that you’ve heard about it, you’ll start seeing it all over the place.
Also, as a general piece of advice, if you want somebody on the internet to help you, don’t start with the words “can u plz”.
]]>Have you ever wondered about the relative popularity of a file you’re looking at in File Exchange? If so, we’ve recently added a new feature to File Exchange that’s meant for you. Beginning this month, if you see a file labeled “Popular File XXXX” under the “Editor’s Notes,” you’ll know... read more >>
]]>The year is also a hyperlink so if you click on it, you’ll see that year’s complete list of top downloaded files.
We hope that by our calling your attention to some of the most popular files on File Exchange you’ll more easily be able to spot and enjoy the best of File Exchange.
If you just can’t wait to happen upon the chosen few, click on the links below to view the lists of Most Popular Files from the past eight years.
2008 2009 2010 2011 2012 2013 2014 2015
And keep an eye on this space if you’re interested in knowing which files made the 2016 list. We’ll be releasing that information soon.
]]>