{"id":3537,"date":"2011-06-16T17:36:32","date_gmt":"2011-06-16T16:36:32","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=3537"},"modified":"2011-06-17T14:06:25","modified_gmt":"2011-06-17T13:06:25","slug":"whats-new-in-matlab-2011a","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=3537","title":{"rendered":"What&#8217;s new in MATLAB 2011a?"},"content":{"rendered":"<p>Every time there is a new MATLAB release I take a look to see which new features interest me the most and share them with the world.\u00a0 If you find this article interesting then you may also enjoy similar articles on <a href=\"https:\/\/www.walkingrandomly.com\/?p=2856\">2010b<\/a> and <a href=\"https:\/\/www.walkingrandomly.com\/?p=2391\">2010a<\/a>.<\/p>\n<p><strong>Simpler random number control<\/strong><\/p>\n<p>MATLAB 2011a introduces the function <strong>rng<\/strong> which allows you to control random number generation much more easily.\u00a0 For example. in older versions of MATLAB you would have to do the following to reseed the default random number stream to something based upon the system time.<\/p>\n<pre>RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock)));<\/pre>\n<p>In MATLAB 2011a you can achieve something similar with<\/p>\n<pre>rng shuffle<\/pre>\n<ul>\n<li>I have updated my <a href=\"https:\/\/www.walkingrandomly.com\/?p=2755\">introduction to parallel random numbers in MATLAB<\/a> to reflect this change.\u00a0 I really need to write part 2 of that series!<\/li>\n<li><a href=\"http:\/\/www.mathworks.com\/videos\/matlab\/new-rng-function-in-r2011a.html\">Click here<\/a> for a Mathworks video showing how this new function works in more detail<\/li>\n<\/ul>\n<p><strong>Faster Functions<\/strong><\/p>\n<p>I love it when The Mathworks improve the performance of some of their functions because you can guarantee that, in an organisation as large as the one I work for, there will always be someone who&#8217;ll be able to say &#8216;Wow! I switched to the latest version of MATLAB and my code runs faster.&#8217;\u00a0 All of the following timings were performed on a 3Ghz quad-core running Ubuntu Linux with the <a href=\"https:\/\/www.walkingrandomly.com\/?p=2856\">cpu-selector turned up to maximum<\/a> for all 4 cores.\u00a0 In all cases the command was run 5 times and an average taken.\u00a0 Some of the faster functions include conv, conv2, qz, complex eig and svd.  The speedup on svd is astonishing!<\/p>\n<pre>a=rand(1,100000);\r\nb=rand(1,100000);\r\ntic;conv(a,b);toc<\/pre>\n<p>MATLAB 2010a: 3.31 seconds<br \/>\nMATLAB 2011a: 1.56 seconds<\/p>\n<pre>a=rand(1000,1000);\r\nb=rand(1000,1000);\r\ntic;q=qz(a,b);toc<\/pre>\n<p>MATLAB 2010a: 36.67 seconds<br \/>\nMATLAB 2011a: 22.87 seconds<\/p>\n<pre>a=rand(1000,1000);\r\ntic;[U,S,V] = svd(a);toc<\/pre>\n<p>MATLAB 2010a: 9.21 seconds<br \/>\nMATLAB 2011a: 0.7114 seconds<\/p>\n<p><strong>Symbolic toolbox gets beefed up<\/strong><\/p>\n<p>Ever since its introduction back in MATLAB 2008b, The Mathworks have been steadily improving the Mupad-based symbolic toolbox.\u00a0 Pretty much all of the integration failures that <a href=\"https:\/\/www.walkingrandomly.com\/?p=1894\">I and my readers identified<\/a> back then have been fixed for example.\u00a0 MATLAB 2011a sees several new improvements but I&#8217;d like to focus on \ufeff\ufeffimprovements for non-algebraic equations.<\/p>\n<p>Take this system of equations<\/p>\n<pre>solve('10*cos(a)+5*cos(b)=x', '10*sin(a)+5*sin(b)=y', 'a','b')<\/pre>\n<p>MATLAB 2011a finds the (extremely complicated) symbolic solution whereas MATLAB 2010b just gave up.<br \/>\nHere&#8217;s another one<\/p>\n<pre>syms an1 an2;\r\neq1 = sym('4*cos(an1) + 3*cos(an1+an2) = 6');\r\neq2 = sym('4*sin(an1) + 3*sin(an1+an2) = 2');\r\neq3 = solve(eq1,eq2);<\/pre>\n<p>MATLAB 2010b only finds one solution set and it&#8217;s approximate<\/p>\n<pre>&gt;&gt; eq3.an1\r\nans =\r\n-0.057562921169951811658913433179187\r\n\r\n&gt;&gt; eq3.an2\r\nans =\r\n0.89566479385786497202226542634536<\/pre>\n<p>MATLAB 2011a, on the other hand, finds two solutions and they are exact<\/p>\n<pre>&gt;&gt; eq3.an1\r\n\r\nans =\r\n 2*atan((3*39^(1\/2))\/95 + 16\/95)\r\n 2*atan(16\/95 - (3*39^(1\/2))\/95)\r\n\r\n&gt;&gt; eq3.an2\r\n\r\nans =\r\n -2*atan(39^(1\/2)\/13)\r\n  2*atan(39^(1\/2)\/13)<\/pre>\n<p><strong>MATLAB Compiler has improved parallel support<\/strong><br \/>\nLifted direct from the MATLAB documentation:<\/p>\n<p><em>MATLAB Compiler generated standalone executables and libraries from parallel applications can now launch up to eight local workers without requiring MATLAB\u00ae Distributed Computing Server\u2122 software.<\/em><\/p>\n<p>Amen to that!<\/p>\n<p><strong>GPU Support has been beefed up in the parallel computing toolbox<\/strong><\/p>\n<p>A load of new functions now support GPUArrays.<\/p>\n<pre>cat\r\ncolon\r\nconv\r\nconv2\r\ncumsum\r\ncumprod\r\neps\r\nfilter\r\nfilter2\r\nhorzcat\r\nmeshgrid\r\nndgrid\r\nplot\r\nsubsasgn\r\nsubsindex\r\nsubsref\r\nvertcat<\/pre>\n<p>You can also index directly into GPUArrays now and the amount of MATLAB code supported by arrayfun for GPUArrays has also been increased to include the following.<\/p>\n<pre>&amp;, |, ~, &amp;&amp;, ||,\r\nwhile, if, else, elseif, for, return, break, continue, eps<\/pre>\n<p>This brings the full list of MATLAB functions and operators supported by the GPU version of arrayfun to<\/p>\n<table class=\"body\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"90%\">\n<colgroup>\n<col width=\"10%\"><\/col>\n<col width=\"14%\"><\/col>\n<col width=\"15%\"><\/col>\n<col width=\"28%\"><\/col>\n<col charoff=\"50\" width=\"29%\"><\/col>\n<\/colgroup>\n<tbody>\n<tr valign=\"top\">\n<td>\n<pre class=\"programlisting\">abs\r\nacos\r\nacosh\r\nacot\r\nacoth\r\nacsc\r\nacsch\r\nasec\r\nasech\r\nasin\r\nasinh\r\natan\r\natan2\r\natanh\r\nbitand\r\nbitcmp\r\nbitor\r\nbitshift\r\nbitxor\r\nceil\r\ncomplex\r\nconj\r\ncos\r\ncosh\r\ncot\r\ncoth<\/pre>\n<\/td>\n<td>\n<pre class=\"programlisting\">csc\r\ncsch\r\ndouble\r\neps\r\nerf\r\nerfc\r\nerfcinv\r\nerfcx\r\nerfinv\r\nexp\r\nexpm1\r\nfalse\r\nfix\r\nfloor\r\ngamma\r\ngammaln\r\nhypot\r\nimag\r\nInf\r\nint32\r\nisfinite\r\nisinf\r\nisnan\r\nlog\r\nlog2<\/pre>\n<\/td>\n<td>\n<pre class=\"programlisting\">log10\r\nlog1p\r\nlogical\r\nmax\r\nmin\r\nmod\r\nNaN\r\npi\r\nreal\r\nreallog\r\nrealpow\r\nrealsqrt\r\nrem\r\nround\r\nsec\r\nsech\r\nsign\r\nsin\r\nsingle\r\nsinh\r\nsqrt\r\ntan\r\ntanh\r\ntrue\r\nuint32<\/pre>\n<\/td>\n<td>\n<pre class=\"programlisting\">+\r\n-\r\n.*\r\n.\/\r\n.\\\r\n.^\r\n==\r\n~=\r\n&lt;\r\n&lt;=\r\n&gt;\r\n&gt;=\r\n&amp;\r\n|\r\n~\r\n&amp;&amp;\r\n||<\/pre>\n<p>Scalar expansion  versions of the  following:<\/p>\n<pre class=\"programlisting\">*\r\n\/\r\n\\\r\n^<\/pre>\n<\/td>\n<td>Branching instructions:<\/p>\n<pre class=\"programlisting\">break\r\ncontinue\r\nelse\r\nelseif\r\nfor\r\nif\r\nreturn\r\nwhile<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The Parallel Computing Toolbox is not the only game in town for GPU support on MATLAB.\u00a0 One alternative is Jacket by Accelereyes and they have p<a href=\"http:\/\/www.accelereyes.com\/products\/compare\">ut up a comparison between the PCT and Jacket<\/a>.\u00a0 At the time of writing it compares against 2011a.<\/p>\n<p>More information about GPU support in various mathematical software packages <a href=\"https:\/\/www.walkingrandomly.com\/?p=3436\">can be found here<\/a>.<\/p>\n<p><strong>Toolbox mergers and acquisitions<\/strong><\/p>\n<p>There have been several license related changes in this version of MATLAB comprising of 2 new products, 4 mergers and one name change.\u00a0 Sadly, none of my <a href=\"https:\/\/www.walkingrandomly.com\/?p=2876\">toolbox-merging suggestions<\/a> have been implemented but let&#8217;s take a closer look at what has been done.<\/p>\n<ul>\n<li>The <strong>Communications Blockset<\/strong> and <strong>Communications Toolbox<\/strong> have merged into what&#8217;s now called the <strong>Communications System Toolbox. <\/strong>This new product requires another new product as a pre-requisite &#8211; <strong>The DSP System Toolbox<\/strong>.<\/li>\n<li>The <strong>DSP System Toolbox<\/strong> isn&#8217;t completely new, however, since it was formed out of a merger between the <strong>Filter Design Toolbox<\/strong> and <strong>Signal Processing Blockset.<\/strong><\/li>\n<li><strong>Stateflow Coder<\/strong> and <strong>Real-Time Workshop<\/strong> have combined their powers to form the new <strong>Simulink Coder<\/strong> which depends upon the new <strong>MATLAB Coder<\/strong>.<\/li>\n<li>The new <strong>Embedded Coder<\/strong> has been formed from the merging of no less than 3 old products: <strong>Real-Time Workshop Embedded Coder<\/strong>, <strong>Target Support Package<\/strong>, and <strong>Embedded IDE Link. <\/strong>This new product also requires the new <strong>MATLAB Coder<\/strong>.<\/li>\n<li><strong>MATLAB Coder <\/strong>is totally new and according to the Mathwork&#8217;s blurb it &#8220;<em>generates standalone C and C++ code from MATLAB<sup>\u00ae<\/sup> code. The generated source code is portable and readable.<\/em>&#8221;\u00a0 I&#8217;m looking forward to trying that out.<\/li>\n<li>Next up, is what seems to be little more than a renaming exercise since the <strong>Video and Image Processing Blockset<\/strong> has been renamed the <strong>Computer Vision System Toolbox<\/strong>.<\/li>\n<\/ul>\n<p>Personally, few of these changes affect me but professionally they do since I have users of many of these toolboxes.\u00a0 An original set of 9 toolboxes has been rationalized into 5 (4 from mergers and the new MATLAB Coder) and I do like it when the number of Mathwork&#8217;s toolboxes goes down.\u00a0 To counter this, there is another new product called <strong>The Phased Array System Toolbox<\/strong>.<\/p>\n<p>So, that rounds up what was important for me in MATLAB 2011a.\u00a0 What did you like\/dislike about it?<\/p>\n<p><strong>Other blog posts about 2011a<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/blogs.mathworks.com\/desktop\/2011\/04\/11\/introducing-matlab-r2011a\/\">Introducing MATLAB 2011a<\/a> &#8211; From Mike on the Desktop<\/li>\n<li><a href=\"http:\/\/blogs.mathworks.com\/seth\/2011\/04\/08\/welcome-to-the-coders\/\">Welcome to the Coders<\/a> &#8211; Guy and Seth on Simulink<\/li>\n<li><a href=\"https:\/\/www.walkingrandomly.com\/?p=3601\">MATLAB 2011a Installation on Linux &#8211; Mount Permission issues<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Every time there is a new MATLAB release I take a look to see which new features interest me the most and share them with the world.\u00a0 If you find this article interesting then you may also enjoy similar articles on 2010b and 2010a. Simpler random number control MATLAB 2011a introduces the function rng which [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,11],"tags":[],"class_list":["post-3537","post","type-post","status-publish","format-standard","hentry","category-math-software","category-matlab"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-V3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3537"}],"version-history":[{"count":24,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3537\/revisions"}],"predecessor-version":[{"id":3633,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3537\/revisions\/3633"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}