*It’s fun to follow along behind an expert, because even with a seemingly simple problem like summing consecutive integers, there’s always more going on than you first realize. And there’s always a new approach to the problem that you would have never considered.*

*Thanks John!*

*-Ned.*

*by John D’Errico*

As an occasional Project Euler solver who has solved several hundred problems (all but one of them in MATLAB, the odd one out I did by hand) Cody intrigues me. So I spent a little time with Cody yesterday. Here are my thoughts, that perhaps you might want to pass along.

Really, mainly I looked at one problem, a rather arbitrary one from the top of the stack. I picked problem 189 to look at. The question was to compute the sum of the integers from 1 to 2^n.

Clearly the simple solution, in fact, one might argue the classic MATLAB solution is simply

y = sum(1:2^n);

Of course this is fast to compute, easy to read, and very obvious what the code does. This is the solution I would jump to almost always, EXCEPT when n is large. For example, what happens if n is 25? 100? The classic solution above will fail to return a result for n=100 before the universe dies from heat death, as 2^100 is such a huge number that any modern computer will never terminate the computation. And simply trying to generate a vector of length 2^100 will exceed the RAM in any computer we could ever imagine. So the classic solution fails miserably, for SOME n. On my machine, I get the following times:

>> timeit(@() sum(1:2^5)) ans = 1.2278e-06 >> timeit(@() sum(1:2^10)) ans = 4.911e-06 >> timeit(@() sum(1:2^15)) ans = 7.7062e-05 >> timeit(@() sum(1:2^20)) ans = 0.002765 >> timeit(@() sum(1:2^25)) ans = 0.1736

As you can see, when n starts to be large enough that the vectors are significantly large, the time also becomes significant, and does so quickly. I would not bother to try it for n=30. The point is that the classic solution fails because it uses an algorithm that is O(2^n). Of course algorithms that suffer from such exponential growth are problematic. This one is fine as long as n is never larger than around 15-20. But exponential run time hits a computational brick wall very quickly.

The solution might be to choose to look more closely at the problem. Is there a mathematical way to reduce the time needed? Clearly, the necessary sum is easy to compute IF one recognizes that for any positive integer n, one can write the integers in the set [1:2^n] as:

[1:2^(n-1) , 2^(n-1) + 1:2^(n-1)]

This merely reflects the binary expansion of these numbers. However it also gives us a nice way to write the desired sum in a recursive fashion. That is, we can write the solution as:

sum_int(n) = sum_int(n-1) + (2^(n-1))^2

So a better code, at least for purely non-negative integer n, might be something like this:

function y = sum_int(x) % For non-negative integer input x, compute the sum of the integers 1:2^x if x == 0 % special case to end the recursion y = 1; else y = 2*sum_int(x - 1) + 2^(2*x-2); end

So we see that sum_int as written above, is actually faster to run, even for n as small as 5, and that the time seems to be linear in n. As one should recognize, sum_int is indeed an O(n) algorithm as written above.

>> timeit(@() sum_int(5)) ans = 7.5692e-07 >> timeit(@() sum_int(10)) ans = 1.7227e-06 >> timeit(@() sum_int(15)) ans = 2.6715e-06 >> timeit(@() sum_int(20)) ans = 3.7462e-06 >> timeit(@() sum_int(25)) ans = 4.6515e-06 >> timeit(@() sum_int(100)) ans = 1.772e-05

In fact, one can even use sum_int to compute the exact value for sym input. Of course sym slows it down, but even that takes only 1/2 second to compute.

>> timeit(@() sum_int(sym(100))) ans = 0.54818 >> sum_int(sym(100)) ans = 803469022129495137770981046171215126561215611592144769253376 >> sum_int(sym(1000)) ans = 57406534763712726211641660058884099201115885104434760023882136841288313069618515692832974315825313495922298231949373138672355948043152766571296567808332659269564994572656140000344389574120022435714463495031743122390807731823194181973658513020233176985452498279081199404472314802811655824768082110985171698215120385828833994926435042413009836474525915918251720110295164670516628746730606637774712420949241272862285974797636825655630482650144583914557794004353013244164891007287546556882572164179254268468766736029354798734808092593495610026430676423398598185956607671495251600324809039074511028408549376

An interesting question is if n should be an integer. Should the code produce an error when n is not integer? Or should it merely produce a result for any non-negative floating point number? My point is that error checking is an important part of good code, as is good documentation that indicates the behavior of the code under all circumstances. So sum_int as written will fail when n is 2.5, or pi, or any non-integer.

Next, a serious problem with SOME recursive schemes is they can suffer from exponential growth themselves. E.g., using recursion to compute the n’th Fibonacci number is a classically poor way to solve the problem. A simple loop (thus O(n)) suffices for reasonably small Fibonacci numbers, although for huge n, there are better schemes to compute Fibonacci numbers that are only O(log2(n)) in complexity. Regardless, one can re-write the function sum_int with a for loop even though the recursive nature of the code is not truly an issue for this problem.

function y = sum_int2(x) % For non-negative integer input x, compute the sum of the integers 1:2^x y = 1; for k = 1:x y = 2*y + 2^(2*k-2); end

This simpler, non-recursive code is as easy to read as the recursive code, and it will run more quickly yet, since it does not suffer from recursive function call overhead. However, it will not produce correct results for sym input. One could fix that problem too, with some effort.

Okay, is this the end of such a discussion? Of course not. We can return to the famous solution by Gauss, that recognizes the natural symmetry in the problem. Thus if we write the sum of the integers

0,1,2, … 2^n-2, 2^n-1, 2^n

then we can compress the sum down by adding them in a different order.

(0 + 2^n) + (1 + 2^n-1) + (2 + 2^n-2) + …

So, the famous formula (attributed to Gauss) for the sum of the integers from 0 to k, can be written as

k*(k+1)/2

Therefore we can write a simpler version yet of this code:

sum_int3 = @(n) 2^n*(2^n+1)/2;

This works because the sum of the integers 0:k is the same as the sum of the integers 1:k. Of course, it produces the correct result, and it is quite fast. As well, it works for any class of input that supports the necessary arithmetic operations.

>> sum_int3(sym(100)) ans = 803469022129495137770981046171215126561215611592144769253376 >> timeit(@() sum_int3(sym(100))) ans = 0.0031585

So any in-depth discussion of the problem should explain issues like this. I’d argue that virtually every problem in Cody would/could benefit from a discussion like this, where the reader can learn how to recognize when a simple algorithm that does quite well for some inputs, may still fail miserably for other input.

Should Cody have some mechanism for expert solvers to explain issues like this? I guess that is up to you to decide, but I would argue that an earnest student could learn a great deal from such a discussion.

In summation, I realize the lessons in my comments are fairly classic:

When writing code, your goal at first should be to find a solution that is at least viable. Get it working FIRST. If there is a problem with time or memory, etc., only then do you consider optimizing your code. Programmers (me included) can often spend far too much time optimizing code that has no need for that.

Programmer time is generally far more valuable than cpu time. So avoid pre-optimization of your code.

When you do look for a code optimization, there are many ways to solve any problem. Sometimes a vectorized solution will be right. Sometimes a looped solution is better. And sometimes it is right to look for mathematical insight to find a completely different solution.

John

]]>Let me start with a graphical riddle. In what sense is the following equivalence true? To learn the answer, read on! I recently came across Nick Higham’s fun post on one-liners in MATLAB. That piece and the approach of Bastille Day on July 14th made me think of another one-line program. image([3 2... read more >>

]]>To learn the answer, read on!

I recently came across Nick Higham’s fun post on one-liners in MATLAB. That piece and the approach of Bastille Day on July 14th made me think of another one-line program.

image([3 2 1]);colormap(flag)

Pretty impressive, considering that it’s only 29 characters long. Is this the shortest flag program we can write?

As I thought about flags and MATLAB, I gave myself the following task. Using only the colormap “flag” and images of vectors, how many national flags can we construct? Probably more than you might guess. Let’s go on a little tour.

Proper flags shouldn’t have numbers running their edges, so I’d like to hide the tick marks and labels. Since I plan to do this multiple times in the script below, I’m going to use an anonymous function for compactness. It’s not necessary, but I like how it keeps the code tidy.

notick = @(ax) set(ax,'XTick',[],'YTick',[])

notick = @(ax)set(ax,'XTick',[],'YTick',[])

In honor of Bastille Day, we start with France.

france = [3 2 1]

france = 3 2 1

```
image(france)
title('Vive la France!')
notick(gca)
```

France is the only red, white, and blue tricolor with vertical bars. But if we look at horizontal patterns, we find many more.

Netherlands is a rotated version of France.

netherlands = rot90(france)

netherlands = 1 2 3

```
image(netherlands);
title('The Netherlands')
notick(gca)
```

Luxembourg, next door to the Netherlands, uses essentially the same flag. A pedantic Luxembourger or professional vexillologist may protest that the colors are slightly lighter and the aspect ratio is slightly different. We will gloss over these details.

luxembourg = netherlands

luxembourg = 1 2 3

```
image(luxembourg)
title('Luxembourg')
notick(gca)
```

thailand = [netherlands; flipud(netherlands)]

thailand = 1 2 3 3 2 1

```
image(thailand)
title('Thailand')
notick(gca)
```

Now we see the significance of the graphical riddle that we listed at the top of this post.

Russia’s flag is a variant on the three horizontal bands. We’ll use circshift to do a circular permutation of the colors in the Netherlands flag.

russia = circshift(netherlands,2)

russia = 2 3 1

```
image(russia)
title('Russia')
notick(gca)
```

austria = netherlands([1 2 1])

austria = 1 2 1

```
image(austria)
title('Austria')
notick(gca)
```

indonesia = netherlands(1:2)

indonesia = 1 2

```
image(indonesia)
title('Indonesia')
notick(gca)
```

monaco = indonesia

monaco = 1 2

```
image(monaco);
title('Monaco')
notick(gca)
```

poland = flipud(monaco)

poland = 2 1

```
image(poland);
title('Poland')
notick(gca)
```

There you have it. A veritable Tour d’Image. I count nine separate vector flags using only red, white, or blue. Did I miss any?

As an exercise for the reader, express all flags in terms of the vector “france”.

In the comments, Matt Tearle points out another flag that fits the model. It’s a kind of dual to Thailand. I am now convinced that vexillology conventions should always occur in the Netherlands, its flag being the indispensable element at the center of all flag alchemy.

costarica = [flipud(netherlands); netherlands]

costarica = 3 2 1 1 2 3

```
image(costarica);
title('Costa Rica')
notick(gca)
```

And Richard Alcock from MathWorks UK writes in to give us this timely and poignant example.

reflex_blue = [0 51 153]/255; yellow = [255 204 0]/255; [x, y] = pol2cart(linspace(0, 2*pi, 13), 1/3); plot(x, y, 'p', 'MarkerSize', 20, ... 'MarkerEdgeColor', yellow, 'MarkerFaceColor', yellow); axis('equal'); set(gca, 'Color', reflex_blue, ... 'XTick', [], 'YTick', [], ... 'Xlim', [-.75 .75], 'Ylim', [-.5, .5])

Sean de Wolski reminded me that black is one of the four colors of the “flag” colormap, thereby letting us add the Yemeni flag to our list. I thought the addition of black might give us a few more flags, but Yemen seems to be the end of it.

```
yemen = [1; 2; 4];
image(yemen)
title('Yemen')
notick(gca)
```

]]>Collaboration on software can be a lot of fun, but it can also be hard to motivate. For instance, you may be working on a project and you’d love some help, but you can’t get anyone else excited about your Interactive Polhode-Herpolhode Animator. Alternatively, you may be willing to help with... read more >>

]]>Collaboration on software can be a lot of fun, but it can also be hard to motivate.

For instance, you may be working on a project and you’d love some help, but you can’t get anyone else excited about your Interactive Polhode-Herpolhode Animator. Alternatively, you may be willing to help with somebody else’s project, but how do you find something that’s interesting to you and simultaneously needs and wants your help? Because if you’re going to spend time hacking code, you want to make sure somebody actually cares.

Well, this is your lucky day: I have solved that problem for you.

I have a project that is both intensely interesting and extraordinarily useful. It only needs a little help from you to realize its full potential.

The project is Export figure to 3D interactive PDF by Ioannis Filippidis (MATLAB Central, GitHub, CalTech). It lets you export a MATLAB figure to a U3D file. Or you can generate the same figure directly in a PDF file. Adobe Reader lets you drag it around like this. Try it yourself with this example file (PDF) or just look at the animation below. Pretty neat, eh?

If you look at the comments, you’ll see a lot of people really like it. But you can also see that it suffers from a few compatibility problems. Ioannis is a busy guy, and he says more than once that you are welcome to fork the GitHub repo and send him a pull request.

So Ioannis is ready for you to help out. Beyond this, I have recently learned from Andreas Goser of the German MathWorks office that a team at Volkswagen makes extensive use of this file. According to Andreas, “the app is not yet running on R2014b and higher and [they] contacted the author who said he had no time yet to port it to new MathWorks graphics.”

So there you have it. A cool project, a supportive author, a waiting audience. You’ll fill your brain with new skills and your heart with the gratitude and admiration of your peers.

The project is linked to from the File Exchange, but it lives on GitHub. Time to get busy!

]]>

I want to show you a trick for finding entertaining MATLAB code. Of course I will always recommend that you start looking on the File Exchange or on Sean and Jiro’s awesome Pick of the Week or maybe the MATLAB Examples page. But after that there’s always Google and the great... read more >>

]]>Obviously you can just enter the search term “matlab”, but that mostly returns information about the product rather than what we want: code written by other MATLAB users. To find that, it’s good to know about published M-files. *Publishing* in MATLAB is the process of generating an HTML document that corresponds to your .m script.

There are piles of beautiful published M-files on the web. But how to find them? For this, we will use a special search term. Every published file automatically includes the phrase “Published with MATLAB” at the bottom of the document. So we can search for that term with the help of Google. This pulls in the files we’re looking for as surely as fish on a line.

Search Term: “published with matlab“

I sometimes like to limit my search to files that are not already on the MathWorks site. The advanced Google search directive “inurl” is good for this. If I say “-inurl:mathworks”, then I’ll only get documents that do not have “mathworks” in the URL.

Search Term: “published with matlab” -inurl:mathworks

That’s looking pretty good. Still, it’s a lot of work to sift through these results one by one. I want more immediate gratification! Let’s make it an image search.

Now that’s what I’m talking about! Every single image on the page corresponds to a lovely MATLAB script. Click through and look at a few of them. For instance, maybe I want to take in the Predator-Prey analysis created by Tobias von Petersdorff at the University of Maryland.

Here’s another good one: Yanghong Huang’s page of ODE examples. Yanghong teaches at the University of Manchester in the UK.

Now I want to take things one step further still. Even if you already knew that you can publish from MATLAB scripts to HTML, you might not know this next part. There is a MATLAB command that lets you extract the original MATLAB code from the HTML. It’s called “grabcode”, and it works like this.

>> url = 'http://personalpages.manchester.ac.uk/staff/yanghong.huang/teaching/MATH36032/html/labdemo7.html '; >> grabcode(url)

Now the MATLAB script file has been reconstituted and opened up in an unnamed editor buffer. We can run the code for ourselves in our own MATLAB.

Here’s one last trick. The most recent release of MATLAB (R2016a) includes the ability to create something called a Live Script. It’s a special kind of script that, notebook-style, lets you include both inputs and outputs in the same dynamic document.

If I save the M-file I got from Manchester as labdemo7.m, then in the Current File Browser, I can right-click and open it up as a Live Script.

If I evaluate the resulting document, I’ll see something like this. The new document is nice because, in contrast to the static HTML file, you can do your calculations and coding right in place in the document.

So there you have it. From the world to your doorstep in a few easy steps. Pretty cool, eh?

]]>Cody is a game that rewards you for calculating the same answer with less code. The very first Cody problem you encounter is called Times 2. It’s a starter problem, so it’s meant to be super simple: write a function that multiplies the input by two. As of this writing, something like 17,000... read more >>

]]>function y = times2(x) y = 2*x; end

The size of the code is given by the number of nodes in the code’s underlying parse tree. Without getting into the details of the parse tree, this function has a size of 12. That’s just about the shortest function possible. You might think it’s the very shortest times2 program one could possibly write. Nevertheless, on June 27, 2010, Dirk Engel submitted a solution that decreased the size from 12 to 10.

He wasn’t cheating, and he got the right answer. How did he do it?

You could scratch your head about this for a long time, so I’ll just tell you. Dating back to Cleve Moler’s original version of MATLAB, whenever you don’t specify a left-hand side for a calculation, the result is placed into a default variable called “ans” (for “answer”, get it?). It’s just one of those quirky things that MATLAB does. Here’s where you might see it at the command line.

>> 2*27 ans = 54

Dirk’s solution exploits this feature. It looks like this.

function ans = times2(x) 2*x; end

See what he did there? The result of the calculation is automatically shoved into ans, which happens to be the return variable shown in the function definition. You probably never want to do this with “real” code. But Cody’s just a game, and we’re confident that people know the difference between competitive code-shrinking and wise practice out in the real world.

You can see from the graph that once this trick gets out, it is widely copied. In fact, it shows up all across the Cody site. Dirk himself was a prolific practitioner of the Ans Hack. But he was not, as it happens, the first. That honor goes to the Old Fox, none other than top Cody player and all-around MATLAB virtuoso Alfonso Nieto-Castanon. It first appears in a solution to Problem 495, Formatting Currency Numbers. Alfonso even adds this comment: *“While on the topic of ‘undocumented trivia that will earn you a couple of Cody points for no good reason’, have you seen this one?”*

Let’s turn back to the Times 2 problem. If you look farther along the graph, you’ll notice a curious thing. The Ans Hack appears for the last time on September 2, 2015. Why did it go away? Did the great mass of Cody players, with one collective will, swear off this nasty habit and consign it to the dustbin of history? Nope. In fact, the Ans Hack *stopped working* with the R2015b release, which came out in September of 2015. You won’t find any ans hacks after that.

Actually, that’s not completely true. The ans variable can still be used inside the function. It just can’t be passed out as an output variable. Ugly as it is, this would still work.

function y = times2(x) 2; y = ans*x; end

So it’s still used for point-shaving all over Cody. Just not as an output argument.

But wherever you see an implicit “ans” as the output argument of a passing entry, you can request a re-score and have the satisfaction of seeing it wither from green to red.

**What Do You Think?**

Do you miss this Ans Hack? Do you wish you could get it back? What are your feelings about point-shaving hacks like this? Harmless hackery in the name of good fun? Or a corrosive influence on the impressionable minds of our coding youth? Let me know in the comments!

]]>I saw another fun MATLAB-related tweet go by, this time about soccer rather than doughnuts. The Euro 2016 tournament is going on right now, and José Pedro Silva tweeted a cool MATLAB-generated visualization about passing between the players. This is showing the passing in the Portugal-Iceland match. https://twitter.com/ZPedro10/status/743115988581896192 The game resulted in... read more >>

]]>https://twitter.com/ZPedro10/status/743115988581896192

The game resulted in a 1-1 draw, but just looking at the passing! The line weights show how many more touches Portugal had than Iceland. And indeed, Iceland only managed 28% of possession.

I don’t have access to the fancy code that generated that plot, but I can use this opportunity to show off MATLAB’s graphing capability. Let’s make up some totally random names and passing statistics for a five-man soccer team.

names = { ... 'Lionel Alpha', 'Cristiano Bravo', 'Gareth Charlie', 'Zlatan Delta', 'Sergio Echo'};

Now we can show the edges of the graph: who passed the ball (source), who received it (target) and how many passes they made (numPasses). The number of passes will be assigned to the weight of each edge. So we can see that Alpha passed to Bravo exactly once during the match. Bravo never returned the favor.

source = [1 1 1 2 3 3 3 3 4 4 4 5 5 5 5]; target = [2 4 5 4 1 2 4 5 2 3 5 1 2 3 4]; numPasses = [1 2 1 1 5 2 2 3 2 2 1 4 6 4 8]; weight = numPasses; G = digraph(source,target,weight,names); G.Nodes

ans = Name _________________ 'Lionel Alpha' 'Cristiano Bravo' 'Gareth Charlie' 'Zlatan Delta' 'Sergio Echo'

G.Edges

ans = EndNodes Weight ______________________________________ ______ 'Lionel Alpha' 'Cristiano Bravo' 1 'Lionel Alpha' 'Zlatan Delta' 2 'Lionel Alpha' 'Sergio Echo' 1 'Cristiano Bravo' 'Zlatan Delta' 1 'Gareth Charlie' 'Lionel Alpha' 5 'Gareth Charlie' 'Cristiano Bravo' 2 'Gareth Charlie' 'Zlatan Delta' 2 'Gareth Charlie' 'Sergio Echo' 3 'Zlatan Delta' 'Cristiano Bravo' 2 'Zlatan Delta' 'Gareth Charlie' 2 'Zlatan Delta' 'Sergio Echo' 1 'Sergio Echo' 'Lionel Alpha' 4 'Sergio Echo' 'Cristiano Bravo' 6 'Sergio Echo' 'Gareth Charlie' 4 'Sergio Echo' 'Zlatan Delta' 8

Look how easy it is to make a simple directed graph. Sergio Echo is clearly a passing machine. For Bravo, it was far better to receive than to give.

plot(G,'Layout','circle','LineWidth',G.Edges.Weight,'ArrowSize',15) axis off]]>

National Doughnut Day was June 3rd. On that day, Sean Breckling was nice enough to tweet this to the universe of MATLAB users: https://twitter.com/BikeMath/status/738818666448314369 I sampled his code (below) and found it delicious, although it had a slight metallic taste (note the copper colormap). X = imread('sprinkles.jpg'); ... read more >>

]]>https://twitter.com/BikeMath/status/738818666448314369

I sampled his code (below) and found it delicious, although it had a slight metallic taste (note the copper colormap).

X = imread('sprinkles.jpg'); t = 0:0.01:1; nt = max(size(t)); outside = 2 + sqrt(1 - t.*t); inside = 2 - sqrt(1 - t.*t); [x,y,z] = cylinder(outside); [xx,yy,zz] = cylinder(inside); surf(x,y,z, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); hold on surf(x,y,-z, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); surf(xx,yy,zz, 'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); surf(xx,yy,-zz,'LineStyle', 'none', 'FaceColor', 'texturemap','EdgeColor','none'); axis tight equal off; colormap('copper'); warp(x,y,z,X) warp(xx,yy,zz,X) hold off

Sorry it took me a while to notice your tweet, Sean. I may be too late to wish you a Happy National Doughnut Day, but by a

fortunate coincidence, today is National Jelly-Filled Doughnut Day (strange but true!). So Happy National Jelly-Filled Doughnut

Day!

In honor of this occasion, here is a doughnut-themed Cody problem: Would Homer Like It?

And finally, through the magic of spherical coordinates, we’ll close with a gratuitous animation. Because doughnut. Mmmm… doughnut.

]]>Today we are renaming this blog and giving it more focus on our MATLAB Central community areas. I’ll be taking a more hands-on approach, with more frequent updates. There’s a lot going on with our community these days, so I’ll have no shortage of things to talk about, but we’re particularly excited about the fact that MATLAB Central is 15 years old this year.

That means I’ve been working here a long time, because I remember the day we launched in the autumn of 2001. At that time, the community consisted of three applications: the File Exchange, the Newsgroup, and the programming contest, although really the contest was intermittent, happening only once every six months or so.

The community has always been one of the fastest-growing areas on our website, so fifteen years later it’s grown into a remarkable constellation of personalities and services. I’m looking forward to talking to you about it.

]]>The Community Team has launched a new landing page for MATLAB Answers. MATLAB Answers is a popular community resource for people looking for solutions to their MATLAB and Simulink problems. There are over 160,000 questions asked and answered by people just like you. The new page makes it easier for... read more >>

]]>The new page makes it easier for novice community members to find solutions to their problems, as well as to ask or answer a question.

When you check out the new landing page, here are a few of the things that you’ll find:

We hope you enjoy the update and welcome your thoughts and reactions. Tell us what you think in the comments below.

]]>This week’s blogger is Bradley Horton. Bradley is an engineer at MathWorks Australia who works with customers in the education area. He has spent the last 16 years helping clients adopt and implement MathWorks products over a broad range of application areas. Big, bold and beautiful – these aren’t the typical... read more >>

]]>Big, bold and beautiful – these aren’t the typical words you’d use to describe an ordinary seminar. But the Australian and New Zealand MATLAB Conference was far from an ordinary event. It was truly an epic event. It is a unique opportunity for the MATLAB community to network with peers across a range of industries and academia. This year, we had new and existing MATLAB and Simulink users learning about the latest product capabilities, and how these capabilities are being used by their peers to solve real world problems.

**Big**: two countries, six cities, 30+ hours of technical presentations, 500+ delegates.**Bold**: technical sessions spanning machine learning, deploying data analytics on the web, automatic code generation for embedded control systems and more.**Beautiful**: guest speakers describing how MATLAB and Simulink have truly accelerated the pace of their production and research projects.

If you missed out on attending this event, here’s how things panned out in Sydney:

*Delegates are always excited to see what’s in this year’s goodie bag!*

The event kicked off with a fascinating keynote presentation – a review of some of the big technology trends that have, and are, continuing to shape our lives. If there was a single message to come from this, then surely it was about the inevitability of technological change – technologies are fusing together to transform industries, companies, employment and education. To keep pace with this change, you either innovate or you stagnate.

As usual we had some great presentations by our two application engineers. On the MATLAB side David gave a nice summary on some of the standout new features to come from the last few releases. Demos showing the new GUI are always popular, but from my chair the introduction of new Robotics System Toolbox™ was the pick of the bunch.

On the Simulink side, Tiffany did an amazing job at demonstrating how many domains can all be modelled in the one environment. One minute we were seeing how a “clapper” detection system works, the next we were modelling a wind turbine. Some seriously cool stuff.

*#GirlsWhoCode – MathWorks presenter Tiffany Liang*

During the morning team break the delegates recharged on some caffeine and cakes and mingled around the booths of our partners – a big shout out to:

- Avnet
- Beckhoff
- Dedicated Systems
- Keysight Technologies
- STMicroelectronics
- Xenon

Clifford and the rest of the STMicroelectronics team have clearly attended these events before – they were giving away free ST discovery boards. Looks like a lot of people want to deploy their Simulink models onto these embedded devices. Nice!

*The STMicroelectronics booth – always popular with the attendees*

There was also a crowd mesmerised by some of the live demos: live 3D scene reconstruction (point cloud) from stereo web cameras, line tracking robots (why is it that an autonomous vehicle programmed by Simulink can be so captivating), live 3D video (anaglyph) from stereo web cameras. The RasperryPi demo also drew some interest especially from the university attendees.

* Delegates checking out Daryl’s live 3D scene reconstruction demo*

After morning tea we had a fantastic lecture on how MATLAB was used for structural health monitoring of the Sydney Harbour Bridge. Thanks to Peter Runcie from NICTA who discussed how the system includes several thousand sensors, distributed data processing, machine learning data analytics, a largescale communications network, web-based user interfaces, and alerting. The system is designed to be applicable to other structures and used by a variety of people including asset managers, inspectors, engineers, and researchers. Very cool stuff and makes me feel a little bit safer each time I drive over the bridge!

*Very popular session on Structural Health Monitoring of the Sydney Harbour Bridge*

In other cities, we also had some fantastic customer presentations: Alinta Energy, City West Water, Tourism and Events Queensland, Operations Insight, Auckland University of Technology and the Innovative Cardiovascular Engineering and Technology Laboratory all showed their innovative work using MATLAB and Simulink.

By this time, there was some buzz on Twitter with attendees live tweeting about their experiences on the day. Lots of people joining in the fun and sharing their views of the event via social media. #MATLABConference15 was looking very popular that day!

*Thanks for the re-Tweet Engineers Australia!*

After Peter’s session we had choices. You either stayed in MATLAB land or you joined a queue to ride the Simulink express.

On the MATLAB side we saw some of the new capabilities that MATLAB has for machine learning. Machine learning seems to be the flavour of the moment, everybody seems to want to classify and/or predict something. So what did I learn? I learnt that delegates nod their heads a lot when they see something interesting – it seems the argument that David presented was well received. If you’re new or old to this machine learning caper, you won’t find a better environment for testing different learning techniques.

*David discussing machine learning*

For the other half of the attendees we saw Tiffany present on our latest capabilities for verification and validation of high integrity systems. If you need to model and generate code for high-integrity systems, you can do so using Model-Based Design. Tiffany showed how to improve model quality via model coverage and design error detection, how to generate embedded code from a controller model and then how to validate the code with back-to-back testing. This was a popular session with a big queue for questions at the end!

And then there was lunch. After some networking, hot food and delicious desserts, there were more choices to make – do I take the BLUE pill and learn about how to build a web site powered by MATLAB, or do I take the RED pill and learn about automatic code generation for embedded control systems. I couldn’t decide so chewed a little on both.

*Lots of networking during the lunch break*

A new topic for this year was Tiffany’s presentation of automatic code generation for embedded control systems. This is some seriously interesting stuff. She showed how Embedded Coder enables users to generate readable and highly efficient C code from MATLAB or a Simulink or Stateflow model, so generated code can be deployed to various MCU/DSPs. Key takeaway: it contributes to create more complex software with better quality in less time. I like the sound of that.

I skipped the end of this session to catch David’s talk on how to build a web site powered by MATLAB. This seemed to be a popular pick with many of the attendees. We are hearing from a lot of customers that they are looking to create or enhance the value of web-based products they offer by adding analytics that give their customers significant insights into their businesses. David showed how you can develop analytics in MATLAB and deploy them as a standalone or to a cloud or server-based library. Very, very cool!

At the end of the day Xenon Systems drew their lucky door prize draw – a fortunate attendee walked home with a brand new graphics card. A big shout out to the team from Xenon – thanks guys.

*Congratulations to the lucky winner!*

I’d be remiss not to mention the fantastic venue: The Powerhouse Museum. A number of delegates (and staff!) took the opportunity to check out some of the spectacular exhibits after the conference ended. The steam strains are always a favourite, as well as the *Excellence in Engineering* exhibition that’s showing right now.

*Awesome venue – we’ll be back!*

So there you have it folks. That’s my review of what the MATLAB Conference was all about. If you want check out the videos, demos and slides from the presentations, you can do so here.

See you next year.

]]>