<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>File Exchange Pick of the Week</title>
	<atom:link href="http://blogs.mathworks.com/pick/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:51:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Units Conversion Toolbox</title>
		<link>http://blogs.mathworks.com/pick/2012/02/03/units-conversion-toolbox/</link>
		<comments>http://blogs.mathworks.com/pick/2012/02/03/units-conversion-toolbox/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 14:51:14 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3190</guid>
		<description><![CDATA[Brett's Pick this week is Units Conversion Toolbox, by John McDermid. Once, a long time ago, I was a real engineer, working on real engineering problems. My trusty HP 48S Scientific Calculator was always by my side when I was working, largely because of its capacity to manage my units. That is, I could readily [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/29621">Units Conversion Toolbox,</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/47554">John McDermid</a>.
   </p>
   <p>Once, a long time ago, I was a real engineer, working on real engineering problems. My trusty HP 48S Scientific Calculator
      was always by my side when I was working, largely because of its capacity to manage my units. That is, I could readily add
      joules to BTUs without worrying about first converting to like units. (This occasionally annoyed my professors when I was
      a student; "my calculator did it for me was rarely well received." On the other hand, it gave me a [perhaps false] sense of
      security when my answer to an involved question came out in appropriate fundamental units.)
      <p>Time marches inevitably onward; I don't do a lot of hard engineering any more. Instead, I get to spend my days helping people
      solve problems in MATLAB. Occasionally, I still need to do some unit conversion and, until recently, those occasions typically
      have had me dusting off the old HP (which is still on my desk!). But I'm always pleased when I find new ways to stay in the
      MATLAB environment, and John's Unit Conversion Toolbox essentially consigns my calculator to the dustbin.
   </p>
   <p>John has done a significant amount of work defining virtually every unit I can think of. It's quite easy to use, and includes
      impressive documentation--including a useful "Getting Started" doc. It also manages prefixes (like 'femto' and 'kilo') seamlessly.
      Now when I add joules to BTUs--and express the answer in either, or in fundamental units, or some different unit of energy--I
      can do it right from MATLAB!
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">x = unit(1,<span style="color: #A020F0">'milliBTU'</span>);
y = unit(2,<span style="color: #A020F0">'joule'</span>);
z = x + y
z2 = convert(z,<span style="color: #A020F0">'cal'</span>)
z3 = convert(z,<span style="color: #A020F0">'dyne'</span>)</pre><pre style="font-style:oblique"> 
z = 
     3.05506 m^2*kg/s^2
 
z2 = 
     0.729688 cal
</pre><pre style="font-style:oblique">Error using unit/convert (line 315)
Incompatible conversion! Fundamental units of m^2*kg/s^2 vs. m*kg/s^2
Error in unitconversion_potw (line 46)
z3 = convert(z,'dyne')</pre><p>
</p>
John implemented this impressive suite using <a href="http://www.mathworks.com/help/techdoc/matlab_oop/ug_intropage.html">MATLAB classes</a>, MATLAB classes, and he took pains to ensure that arithmetic operations work as expected. And I'm encouraged that when I
      tried to do something foolish there, the unit class told me about it!
   </p>
   <p>Very useful, John--thanks for sharing this!</p>
   <p>As always, <a href="http://blogs.mathworks.com/pick/?p=3190#respond">comments to this blog post</a> are welcome. Or leave a comment for John <a href="http://www.mathworks.com/matlabcentral/fileexchange/29621#comments">here</a>.
   </p><script language="JavaScript">
<!--

    function grabCode_2530829bc5f649f4bbeb5a2b0c2d022a() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='2530829bc5f649f4bbeb5a2b0c2d022a ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 2530829bc5f649f4bbeb5a2b0c2d022a';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2012 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_2530829bc5f649f4bbeb5a2b0c2d022a()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.14<br /></p>
</div>
<!--
2530829bc5f649f4bbeb5a2b0c2d022a ##### SOURCE BEGIN #####
%% Unit Conversion Tool
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/29621 Units Conversion Toolbox,> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/47554 John McDermid>.

%%
% Once, a long time ago, I was a real engineer, working on
% real engineering problems. My trusty HP 48S
% Scientific Calculator was always by my side when I was
% working, largely because of its capacity to manage my
% units. That is, I could readily add joules to BTUs
% without worrying about first converting to like units.
% (This occasionally annoyed my professors when I was a
% student; "my calculator did it for me was rarely well
% received." On the other hand, it gave me a [perhaps false]
% sense of security when my answer to an involved question
% came out in appropriate fundamental units.)

%%
% Time marches inevitably onward; I don't do a lot of hard engineering
% any more. Instead, I get to spend my days helping people solve problems
% in MATLAB. Occasionally, I still need to do some unit
% conversion and, until recently, those occasions typically
% have had me dusting off the old HP (which is still on my
% desk!). But I'm always pleased when I find new ways to
% stay in the MATLAB environment, and John's Unit
% Conversion Toolbox essentially consigns my calculator to
% the dustbin.

%%
% John has done a significant amount of work defining
% virtually every unit I can think of. It's quite easy to
% use, and includes impressive documentationREPLACE_WITH_DASH_DASHincluding a useful "Getting
% Started" doc. It also manages prefixes (like 'femto' and
% 'kilo') seamlessly. Now when I add joules to BTUsREPLACE_WITH_DASH_DASHand 
% express the answer in either, or in fundamental units, or
% some different unit of energyREPLACE_WITH_DASH_DASHI can do it right from
% MATLAB!

%%
x = unit(1,'milliBTU');
y = unit(2,'joule');
z = x + y
z2 = convert(z,'cal')
z3 = convert(z,'dyne')

%%
% 
% John implemented this impressive suite using
% <http://www.mathworks.com/help/techdoc/matlab_oop/ug_intropage.html MATLAB classes>,
% MATLAB classes, and he took pains to ensure that
% arithmetic operations work as expected. And I'm encouraged
% that when I tried to do something foolish there, the unit
% class told me about it!  

%%
% Very useful, JohnREPLACE_WITH_DASH_DASHthanks for sharing this!

%% 
% As always, <http://blogs.mathworks.com/pick/?p=3190#respond comments to this blog post> are welcome. Or leave a
% comment for John
% <http://www.mathworks.com/matlabcentral/fileexchange/29621#comments here>.

##### SOURCE END ##### 2530829bc5f649f4bbeb5a2b0c2d022a
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2012/02/03/units-conversion-toolbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A non-engineer tinkers with Simulink</title>
		<link>http://blogs.mathworks.com/pick/2012/01/27/a-non-engineer-tinkers-with-simulink/</link>
		<comments>http://blogs.mathworks.com/pick/2012/01/27/a-non-engineer-tinkers-with-simulink/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 14:38:46 +0000</pubDate>
		<dc:creator>Guest Picker</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3166</guid>
		<description><![CDATA[Greg's pick this week is A non-engineer tinkers with Simulink by Dimitri Shvorob. Contents Non-Engineer Using Simulink&#8230;Does Not Compute. Can the Rest of Us Learn to Label Blocks Too? Non-Engineer Using Simulink&#8230;Does Not Compute. Although I don&#8217;t always understand our users' day-to-day jobs, I&#8217;m always interested to learn how they are applying MathWorks tools--especially for [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/32620">Greg's</a> pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/18880-a-non-engineer-tinkers-with-simulink">A non-engineer tinkers with Simulink</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/17777">Dimitri Shvorob</a>.
      </p>
   </introduction>
   <h3>Contents</h3>
   <div>
      <ul>
         <li><a href="#1">Non-Engineer Using Simulink&#8230;Does Not Compute.</a></li>
         <li><a href="#2">Can the Rest of Us Learn to Label Blocks Too?</a></li>
      </ul>
   </div>
   <h3>Non-Engineer Using Simulink&#8230;Does Not Compute.<a name="1"></a></h3>
   <p>Although I don&#8217;t always understand our users' day-to-day jobs, I&#8217;m always interested to learn how they are applying MathWorks tools--especially for &#8220;non-traditional&#8221; applications.
   </p>
   <p>And while I&#8217;m not sure finance will be the next major boom market for Simulink, I find Dimitri&#8217;s perspective on Simulink refreshing.</p>
   <p>For example, in Dimitri&#8217;s models:</p>
   <li>The units of time are years rather than seconds</li>
   <li>Block names and titles describe the purpose of their operation</li>
   <li>The models contain a plethora of additional documentation</li>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/greg/CFA_Simulink_Writeup/Model4.PNG"> </p>
   <p>While these are not the most sophisticated models you will ever see, they are clean and simple to follow. Which is more than
      I can say for many a model I have produced.
   </p>
   <h3>Can the Rest of Us Learn to Label Blocks Too?<a name="2"></a></h3>
   <p>I am certainly guilty of building a model quickly to describe some particular dynamic system, but then forgetting to go through
      and change my block names. All of a sudden I have 20 blocks all named  &#8220;Subsystem&#8221;, and I forget why they are in the model
      and what they do.  This is especially painful if I end up going back to the model after a couple of weeks.
   </p>
   <p>As someone who often needs to work with Simulink models built by other people,  I don&#8217;t know that I can suggest strongly enough
      the value in spending the extra time to flesh out the model with details like block names, signal names, and occasionally,
      general comments as Simulink Annotations.
   </p>
   <p>On the other hand, it does speak to how powerful a tool Simulink can be, that we can construct a complex, sophisticated simulation
      without ever labeling a single block. (Although, I&#8217;m not sure I want to admit to that in print!)
   </p>
   <p><b>Comments</b></p>
   <p>If you would like to leave any comments regarding this post, please click <a href="http://blogs.mathworks.com/pick/?p=3166#respond">here</a>.
   </p>
   <p>Or you can leave a comment for Dimitri Shvorob <a href="http://www.mathworks.com/matlabcentral/fileexchange/18880#comments">here</a>.   </p><script language="JavaScript">
<!--

    function grabCode_233102ae9d314f3686e67d0b5451c0cb() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='233102ae9d314f3686e67d0b5451c0cb ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 233102ae9d314f3686e67d0b5451c0cb';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Greg Wolff';
        copyright = 'Copyright 2012 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_233102ae9d314f3686e67d0b5451c0cb()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
233102ae9d314f3686e67d0b5451c0cb ##### SOURCE BEGIN #####
%% A non-engineer tinkers with Simulink
%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/32620 Greg's>
% pick this week is 
% <http://www.mathworks.com/matlabcentral/fileexchange/18880-a-non-engineer-tinkers-with-simulink A non-engineer tinkers with Simulink>
% by <http://www.mathworks.com/matlabcentral/fileexchange/authors/17777 Dimitri Shvorob>.
% 


%% Non-Engineer Using Simulinkâ€¦Does Not Compute.
% Although I donâ€™t always understand our users' day-to-day jobs, I'm always
% interested to learn how they are applying MathWorks tools--especially for
% â€œnon-traditionalâ€� applications. 
% 
% And while Iâ€™m not sure finance will be the
% next major boom market for Simulink, I find Dimitriâ€™s perspective on
% Simulink refreshing. 
%
% For example, in Dimitriâ€™s models:
% 
% # The units of time are years rather than seconds
% # Block names and titles describe the purpose of their operation
% # The models contain a plethora of additional documentation
%
% <<Model4.PNG>>
%
% While these are not the most
% sophisticated models you will ever see, they are clean and simple to
% follow. Which is more than I can say for many a model I have produced.
% 
%% Can the Rest of Us Learn to Label Blocks Too? 
% I am certainly guilty of
% building a model quickly to describe some particular dynamic system, but
% then forgetting to go through and change my block names. All of a sudden I
% have 20 blocks all named  â€œSubsystemâ€�, and I forget why they are in the
% model and what they do.  This is especially painful if I end up going
% back to the model after a couple of weeks. 
%
% As someone who often needs to
% work with Simulink models built by other people,  I donâ€™t know that I can
% suggest strongly enough the value in spending the extra time to flesh out
% the model with details like block names, signal names, and occasionally,
% general comments as Simulink Annotations. 
%
% On the other hand, it does
% speak to how powerful a tool Simulink can be, that we can construct a
% complex, sophisticated simulation without ever labeling a single block.
% (Although, Iâ€™m not sure I want to admit to that in print!)



%%
% *Comments*
%
% If you would like to leave any comments regarding this post, please click 
% <http://blogs.mathworks.com/pick/?p=3166#respond here>. 
%
% Or you can leave a comment for Dimitri Shvorob
% <<http://www.mathworks.com/matlabcentral/fileexchange/18880 here>.
##### SOURCE END ##### 233102ae9d314f3686e67d0b5451c0cb
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2012/01/27/a-non-engineer-tinkers-with-simulink/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Publishing called functions</title>
		<link>http://blogs.mathworks.com/pick/2012/01/20/publishing-called-functions/</link>
		<comments>http://blogs.mathworks.com/pick/2012/01/20/publishing-called-functions/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 13:54:00 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3154</guid>
		<description><![CDATA[Jiro's pick this week is "Publish dependent and called functions" by Nick Angelini. Publishing is one of the things I always highlight to MATLAB users, new or experienced. Even though the feature has been around for over 7 years, not many people know about it. I was one of those people who went through graduate [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/33476">"Publish dependent and called functions"</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/116098">Nick Angelini</a>.
   </p>
   <p><a href="http://www.mathworks.com/help/techdoc/matlab_env/f6-22451.html">Publishing</a> is one of the things I always highlight to MATLAB users, new or experienced. Even though the feature has been around for
      over 7 years, not many people know about it. I was one of those people who went through graduate school manually creating
      reports from figures generated in MATLAB. Now, publishing is something that I can't live without. Even many of the bloggers
      (myself included) on MATLAB Central use <a href="http://www.mathworks.com/help/techdoc/ref/publish.html"><tt>publish</tt></a> to write the blog posts.
   </p>
   <p>I was pretty excited to see this entry by Nick. I've always wanted to make something like this, but I never got around to
      implementing it. While <tt>publish</tt> would only generate a report for the function or the script you specify, <tt>publishdepfun</tt> will generate separate reports for any user-defined functions used in the main file, and even append the report to the end
      of the main report. I immediately found one of my demos that I show at seminars and published it. The syntax is pretty much
      identical to the MATLAB's <tt>publish</tt> command. You can also pass in the options structure that's accepted by <tt>publish</tt>.
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">publishdepfun(<span style="color: #A020F0">'MainAnalysis'</span>);</pre><p>My <tt>MainAnalysis.m</tt> script had 3 custom functions: <tt>createFit.m</tt>, <tt>createfigure.m</tt>, and <tt>importfile.m</tt>. Those 3 functions were published as well and were appended to the end of the main report. As you can see below, the report
      has a section called "Called Functions".
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_publishdepfun/publishdepfun_screenshot.PNG"> </p>
   <p><b>Comments</b></p>
   <p>He states in entry that there are still some limitations, but I think this is a great start and has plenty of good utility.
      Let us know what you think <a href="http://blogs.mathworks.com/pick/?p=3154#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/33476#comments">comment</a> for Nick.
   </p><script language="JavaScript">
<!--

    function grabCode_c2e211b4717d4a858707784b1d41fcfd() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='c2e211b4717d4a858707784b1d41fcfd ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' c2e211b4717d4a858707784b1d41fcfd';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Jiro Doke';
        copyright = 'Copyright 2012 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_c2e211b4717d4a858707784b1d41fcfd()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
c2e211b4717d4a858707784b1d41fcfd ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/33476 "Publish
% dependent and called functions"> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/116098 Nick
% Angelini>.
%
% <http://www.mathworks.com/help/techdoc/matlab_env/f6-22451.html
% Publishing> is one of the things I always highlight to MATLAB users, new
% or experienced. Even though the feature has been around for over 7 years,
% not many people know about it. I was one of those people who went through
% graduate school manually creating reports from figures generated in
% MATLAB. Now, publishing is something that I can't live without. Even many
% of the bloggers (myself included) on MATLAB Central use
% <http://www.mathworks.com/help/techdoc/ref/publish.html |publish|> to
% write the blog posts.
%
% I was pretty excited to see this entry by Nick. I've always wanted to
% make something like this, but I never got around to implementing it.
% While |publish| would only generate a report for the function or the
% script you specify, |publishdepfun| will generate separate reports for
% any user-defined functions used in the main file, and even append the
% report to the end of the main report. I immediately found one of my demos
% that I show at seminars and published it. The syntax is pretty much
% identical to the MATLAB's |publish| command. You can also pass in the
% options structure that's accepted by |publish|.

publishdepfun('MainAnalysis');

%%
% My |MainAnalysis.m| script had 3 custom functions: |createFit.m|,
% |createfigure.m|, and |importfile.m|. Those 3 functions were published as
% well and were appended to the end of the main report. As you can see
% below, the report has a section called "Called Functions".
%
% <<publishdepfun_screenshot.PNG>>
%
% *Comments*
%
% He states in entry that there are still some limitations, but I think
% this is a great start and has plenty of good utility. Let us know what
% you think <http://blogs.mathworks.com/pick/?p=3154#respond here> or leave
% a <http://www.mathworks.com/matlabcentral/fileexchange/33476#comments
% comment> for Nick.

##### SOURCE END ##### c2e211b4717d4a858707784b1d41fcfd
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2012/01/20/publishing-called-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag Objects Conveniently</title>
		<link>http://blogs.mathworks.com/pick/2012/01/13/drag-objects-conveniently-2/</link>
		<comments>http://blogs.mathworks.com/pick/2012/01/13/drag-objects-conveniently-2/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 13:24:00 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3139</guid>
		<description><![CDATA[Brett's Pick this week is Draggable, by Francois Bouffard. For a pet project of mine, I needed to implement (in MATLAB code, of course!) a repositionable, resizable rectangle. I wanted to be able to drag the rectangle itself, but I also wanted to expose "handles" that would allow me to drag from the sides or [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/4179-draggable">Draggable,</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/10751">Francois Bouffard</a>.
   </p>
   <p>For a pet project of mine, I needed to implement (in MATLAB code, of course!) a repositionable, resizable rectangle. I wanted
      to be able to drag the rectangle itself, but I also wanted to expose "handles" that would allow me to drag from the sides
      or from the corners, and to control, or constrain, the motion.
   </p>
   <p>As a first step, I needed a general function that facilitated "draggability" of MATLAB objects. That's where "Draggable" comes
      in. Starting, as I usually do, with the File Exchange, I quickly found my way to Francois's file. I downloaded it, encouraged
      by several 5-star reviews (now including my own!), and was very pleased by how tractable the problem became.
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/draggable2.gif"> </p>
   <p>"Draggable" is exceptionally well implemented, and despite having taken it for a significant test drive, I have been unable
      to find fault with it.
   </p>
   <p>Francois mentioned in his comments that he plans to revisit his code at some point in the future to  enable one to apply the
      functionality simultaneously to multiple handles. I agree that that would make a nice enhancement, though activating objects
      one-at-a-time wasn't extremely onerous. It would also be nice if there were a "diagonal" constraint--at least for my purposes.
      But in its current state, I'm very happy to select "Draggable" as this week's Pick of the Week--very nice work, Francois!
   </p>
   <p>Incidentally, my "draggableRect" isn't on the File Exchange <i>yet</i>, but I hope to have it up soon!
   </p>
   <p>As always, <a href="http://blogs.mathworks.com/pick/?p=3139#respond">comments to this blog post</a> are welcome. Or leave a comment for Francois <a href="http://www.mathworks.com/matlabcentral/fileexchange/4179-draggable#comments">here</a>.
   </p><script language="JavaScript">
<!--

    function grabCode_5988cd6d582d4b7eb91c1a745c892e53() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='5988cd6d582d4b7eb91c1a745c892e53 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 5988cd6d582d4b7eb91c1a745c892e53';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2012 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_5988cd6d582d4b7eb91c1a745c892e53()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.14<br /></p>
</div>
<!--
5988cd6d582d4b7eb91c1a745c892e53 ##### SOURCE BEGIN #####
%% Drag Objects Conveniently
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/4179-draggable Draggable,> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/10751 Francois Bouffard>.

%%
% For a pet project of mine, I needed to implement (in
% MATLAB code, of course!) a repositionable, resizable
% rectangle. I wanted to be able to drag the rectangle
% itself, but I also wanted to expose "handles" that would
% allow me to drag from the sides or from the corners, and
% to control, or constrain, the motion.

%%
% As a first step, I needed a general function that
% facilitated "draggability" of MATLAB objects. That's where
% "Draggable" comes in. Starting, as I usually do, with the
% File Exchange, I quickly found my way to Francois's file.
% I downloaded it, encouraged by several 5-star reviews (now
% including my own!), and was very pleased by how tractable
% the problem became.

%%
% 
% <<http://blogs.mathworks.com/pick/files/draggable2.gif>>
% 

%%
% "Draggable" is exceptionally well implemented, and despite
% having taken it for a significant test drive, I have been
% unable to find fault with it. 
%

%%
% Francois mentioned in his comments that he plans to
% revisit his code at some point in the future to  enable
% one to apply the functionality simultaneously to multiple
% handles. I agree that that would make a nice enhancement,
% though activating objects one-at-a-time wasn't extremely
% onerous. It would also be nice if there were a "diagonal"
% constraintREPLACE_WITH_DASH_DASHat least for my purposes. But in its current
% state, I'm very happy to select "Draggable" as this week's
% Pick of the WeekREPLACE_WITH_DASH_DASHvery nice work, Francois!

%%
% Incidentally, my "draggableRect" isn't on the File Exchange
% _yet_, but I hope to have it up soon!

%% 
% As always, <http://blogs.mathworks.com/pick/?p=3139#respond comments to this blog post> are welcome. Or leave a
% comment for Francois
% <http://www.mathworks.com/matlabcentral/fileexchange/4179-draggable#comments here>.

##### SOURCE END ##### 5988cd6d582d4b7eb91c1a745c892e53
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2012/01/13/drag-objects-conveniently-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watch HDTV in MATLAB</title>
		<link>http://blogs.mathworks.com/pick/2012/01/06/watch-hdtv-in-matlab/</link>
		<comments>http://blogs.mathworks.com/pick/2012/01/06/watch-hdtv-in-matlab/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 14:40:41 +0000</pubDate>
		<dc:creator>Guest Picker</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3087</guid>
		<description><![CDATA[Idin's Pick this week is ATSC: From RF to Video, by Dick Benson. Watch HDTV in MATLAB? Well, not quite. This submission shows how to receive ATSC signals (standard used for HDTV in North America) using MATLAB/Simulink, but it&#8217;s not real-time. Nonetheless, this is one of the most complete examples of a communication system available [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/29096">Idin</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/32651">ATSC: From RF to Video,</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/4156">Dick Benson</a>.
   </p>
   <p>Watch HDTV in MATLAB? Well, not quite.  This submission shows how to receive ATSC signals (standard used for HDTV in North
      America) using MATLAB/Simulink, but it&#8217;s not real-time. Nonetheless, this is one of the most complete examples of a communication
      system available on MATLAB Central as it contains every aspect of the receiver from RF to the final video stream. It shows
      how a standards document comes to life, following a top-down design approach (see the ReadMe file).
   </p>
   <p>The files in this submission show an ATSC receiver that can demodulate, decode, and display a captured off-the-air TV signal.
      The data file containing the captured signal is provided separately <a href="http://www.mathworks.com/supportfiles/spc/ATSC/ATSC_Data.zip">here</a> (1.8 GB). The data file contains a 20-second signal from a weather broadcast on WCBV in the Boston area.
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/VideoWCBV1.png"> </p>
   <p>The final model for processing captured signals is shown below:</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/SimulinkFinalModel1.png"> </p>
   <p>The raw captured data is passed through two other models to do timing/carrier synchronization and equalization before it is
      passed to this model. This model contains the symbol processing that follows all front-end processing (it does demodulation,
      decoding, and MPEG-2 file creation). The final result is an MPEG-2 video transport stream (.ts) file that can be played using
      Windows Media Player (or any other MPEG-2 player).
   </p>
   <p>The ReadMe file contains detailed description of the algorithms used in each model along with references. It serves as a nice
      tutorial for using Simulink as well as designing digital receivers (not just ATSC).
   </p>
   <p>Overall, this is a great submission that can be used as a guide in designing any digital receiver in Simulink. It covers every
      aspect of the problem from capturing off-the-air signals to synchronization and debugging of the models. For more basic tutorials
      and examples on using Simulink for communication system design, see the demos in the <a href="http://www.mathworks.com/help/releases/R2012a/toolbox/comm/comm_product_page.html">Communications System Toolbox</a> (or the Communications Blockset in R2010b and older versions).
   </p>
   <p><b>Brief ATSC Standard Background</b></p>
   <p><a href="http://en.wikipedia.org/wiki/ATSC_standards">ATSC</a> standards for digital video transmission were developed in the 1990s by American Television Systems Committee. ATSC was adopted
      by the FCC in the US in mid-90s; however, the switch to digital did not occur until 2009. In June 2009, television broadcast
      in the US converted from analog NTSC to digital ATSC (more commonly referred to as &#8220;digital TV&#8221; or &#8220;HDTV&#8221;). Canada switched
      in August 2011, with Mexico to follow in 2015. ATSC uses 8-VSB modulation over the air, protected by Reed-Solomon error-correction
      coding. The video stream is encoded using MPEG-2 specifications, and Dolby Digital&#8217;s AC-3 audio codec is used for audio encoding.
   </p>
   <p><a href="http://blogs.mathworks.com/pick/?p=3087#respond">Let us know what you think</a>, or leave a comment for Dick <a href="http://www.mathworks.com/matlabcentral/fileexchange/32651#comments">here</a>!
   </p><script language="JavaScript">
<!--

    function grabCode_ce190790839f4b589e44b0b93dfb1ad2() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='ce190790839f4b589e44b0b93dfb1ad2 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' ce190790839f4b589e44b0b93dfb1ad2';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2012 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_ce190790839f4b589e44b0b93dfb1ad2()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.14<br /></p>
</div>
<!--
ce190790839f4b589e44b0b93dfb1ad2 ##### SOURCE BEGIN #####
%% Watch HDTV in MATLAB
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/29096 Idin>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/32651 ATSC: From RF to Video,> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/4156 Dick Benson>.

%%
% Watch HDTV in MATLAB? Well, not quite.  This submission
% shows how to receive ATSC signals (standard used for HDTV
% in North America) using MATLAB/Simulink, but itâ€™s not
% real-time. Nonetheless, this is one of the most complete
% examples of a communication system available on MATLAB
% Central as it contains every aspect of the receiver from
% RF to the final video stream. It shows how a standards
% document comes to life, following a top-down design
% approach (see the ReadMe file).

%%
% The files in this submission show an ATSC receiver that
% can demodulate, decode, and display a captured off-the-air
% TV signal. The data file containing the captured signal is
% provided separately <http://www.mathworks.com/supportfiles/spc/ATSC/ATSC_Data.zip here> (1.8 GB).
% The data file contains a 20-second signal from a
% weather broadcast on WCBV in the Boston area.

%%
% 
% <<http://blogs.mathworks.com/pick/files/VideoWCBV1.png>>
% 

%%
% The final model for processing captured signals is shown below:

%%
% 
% <<http://blogs.mathworks.com/pick/files/SimulinkFinalModel1.png>>
% 

%%
% The raw captured data is passed through two other models
% to do timing/carrier synchronization and equalization
% before it is passed to this model. This model contains the
% symbol processing that follows all front-end processing
% (it does demodulation, decoding, and MPEG-2 file
% creation). The final result is an MPEG-2 video transport
% stream (.ts) file that can be played using Windows Media
% Player (or any other MPEG-2 player).

%% 
% The ReadMe file contains detailed description of the
% algorithms used in each model along with references. It
% serves as a nice tutorial for using Simulink as well as
% designing digital receivers (not just ATSC).

%%
% Overall, this
% is a great submission that can be used as a guide in
% designing any digital receiver in Simulink. It covers
% every aspect of the problem from capturing off-the-air
% signals to synchronization and debugging of the models.
% For more basic tutorials and examples on using Simulink
% for communication system design, see the demos in the
% <http://www.mathworks.com/help/releases/R2012a/toolbox/comm/comm_product_page.html Communications System Toolbox> 
% (or the Communications Blockset
% in R2010b and older versions).

%%
% *Brief ATSC Standard Background*
% 
% <http://en.wikipedia.org/wiki/ATSC_standards ATSC>
% standards for digital video transmission were developed in
% the 1990s by American Television Systems Committee. ATSC
% was adopted by the FCC in the US in mid-90s; however, the
% switch to digital did not occur until 2009. In June 2009,
% television broadcast in the US converted from analog NTSC
% to digital ATSC (more commonly referred to as â€œdigital TVâ€�
% or â€œHDTVâ€�). Canada switched in August 2011, with Mexico to
% follow in 2015. ATSC uses 8-VSB modulation over the air,
% protected by Reed-Solomon error-correction coding. The
% video stream is encoded using MPEG-2 specifications, and
% Dolby Digitalâ€™s AC-3 audio codec is used for audio
% encoding.

%% 
% <http://blogs.mathworks.com/pick/?p=3087#respond Let us know what you think>, or leave a
% comment for Dick
% <http://www.mathworks.com/matlabcentral/fileexchange/32651#comments here>!

##### SOURCE END ##### ce190790839f4b589e44b0b93dfb1ad2
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2012/01/06/watch-hdtv-in-matlab/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically add copyright information to your MATLAB files</title>
		<link>http://blogs.mathworks.com/pick/2011/12/30/automatically-add-copyright-information-to-your-matlab-files/</link>
		<comments>http://blogs.mathworks.com/pick/2011/12/30/automatically-add-copyright-information-to-your-matlab-files/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 11:37:14 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3056</guid>
		<description><![CDATA[Jiro's pick this week is addcopyright by Mirko Hrovat. As a customer-facing engineer at MathWorks, I distribute a lot of MATLAB example files, including files posted on the File Exchange. As a policy, we add copyright information to our MATLAB files. I spend some non-trivial amount of time opening files and adding the copyright information [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/16441"><tt>addcopyright</tt></a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/17512">Mirko Hrovat</a>.
   </p>
   <p>As a customer-facing engineer at MathWorks, I distribute a lot of MATLAB example files, including files posted on the File
      Exchange. As a policy, we add copyright information to our MATLAB files. I spend some non-trivial amount of time opening files
      and adding the copyright information to all of my files just before distribution. Little did I know that Mirko had created
      a nice utility for helping me with the process! He took the <a href="http://www.mathworks.com/matlabcentral/fileexchange/3949">original entry</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/1608">Raymond</a>, one of my colleagues, and made some improvements to it.
   </p>
   <p>The function adds a copyright text in the following format:</p><pre> %   Copyright 2011 The MathWorks, Inc.<p></p></pre><p>One of lesser known features of a copyright string like the one above is that when you <a href="http://www.mathworks.com/help/techdoc/matlab_env/f6-22451.html">publish</a> a file with this comment, it adds a footnote at the bottom with the copyright information:
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_addcopyright/copyright_footnote.png"> </p>
   <p>The function is easy to use. To add a copyright line to all MATLAB files under "C:myDemos", simply type:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">addcopyright <span style="color: #A020F0">C:myDemos</span></pre><p>or you can apply this to individual files:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">addcopyright <span style="color: #A020F0">myFcn.m</span></pre><p>The function has many other options, such as customizing the organization name and the copyright year. Mirko describes in
      detail the modifications to Raymond's entry, but here are some of the ones I like:
   </p>
   <div>
      <ul>
         <li><i><b>Copyright line is added either before $Revision keyword or after a blank line.</b></i> MATLAB files shipped with the product all contain revision information (edit any MATLAB function). But most of my files don't
            have a "$Revision" line, so I like the fact that it looks for a blank line.
         </li>
         <li><i><b>Ability to have multiple copyrights with different organizations.</b></i> If the file already contains a copyright, calling the function with a different organization name appends a new copyright
            line. This is useful when I am updating a file written by someone else from a different organization.
         </li>
         <li><i><b>Automatic update of multi-year copyrights.</b></i> If the file already contains "Copyright 2009", then calling it again with 2011 will change it to "Copyright 2009-2011".
         </li>
         <li><i><b>Support for command syntax.</b></i> <a href="http://www.mathworks.com/help/techdoc/ref/syntax.html#f76-1098266">Command syntax</a> is useful when appropriate, and I think it's quite appropriate here. My examples above use command syntax. Compare this with
            the function syntax: <tt>addcopyright('myFcn.m')</tt></li>
         <li><i><b>Ability to remove copyright line.</b></i> It's always nice to be able to undo the process.
         </li>
         <li><i><b>Ability to add copyright to a single file (as opposed to all files inside folders).</b></i> Sometimes, I just want to update a single file within a folder, so this is quite useful for me.
         </li>
      </ul>
   </div>
   <p>Thanks Mirko for this useful entry!</p>
   <p><b>Comments</b></p>
   <p>Give this a try and let us know what you think <a href="http://blogs.mathworks.com/pick/?p=3056#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/16441#comments">comment</a> for Mirko.
   </p>
   <p>Oh, and I wish everyone a great new upcoming year!</p><script language="JavaScript">
<!--

    function grabCode_3f28cad08a7d4a7c8c0d69a9c19f4988() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='3f28cad08a7d4a7c8c0d69a9c19f4988 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 3f28cad08a7d4a7c8c0d69a9c19f4988';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use 'x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/x3C/g, 'x26#60;');

        author = 'Jiro Doke';
        copyright = 'Copyright 2011 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray">Copyright 2011 The MathWorks, Inc.<br /><a href="javascript:grabCode_3f28cad08a7d4a7c8c0d69a9c19f4988()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
3f28cad08a7d4a7c8c0d69a9c19f4988 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/16441
% |addcopyright|> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/17512 Mirko
% Hrovat>.
%
% As a customer-facing engineer at MathWorks, I distribute a lot of MATLAB
% example files, including files posted on the File Exchange. As a policy,
% we add copyright information to our MATLAB files. I spend some
% non-trivial amount of time opening files and adding the copyright
% information to all of my files just before distribution. Little did I
% know that Mirko had created a nice utility for helping me with the
% process! He took the
% <http://www.mathworks.com/matlabcentral/fileexchange/3949 original entry>
% by <http://www.mathworks.com/matlabcentral/fileexchange/authors/1608
% Raymond>, one of my colleagues, and made some improvements to it.
%
% The function adds a copyright text in the following format:
%
%   %   Copyright 2011 The MathWorks, Inc.
%
% One of lesser known features of a copyright string like the one above is
% that when you
% <http://www.mathworks.com/help/techdoc/matlab_env/f6-22451.html publish>
% a file with this comment, it adds a footnote at the bottom with the
% copyright information:
%
% <<copyright_footnote.png>>
%
% The function is easy to use. To add a copyright line to all MATLAB files
% under "C:myDemos", simply type:

addcopyright C:myDemos

%%
% or you can apply this to individual files:

addcopyright myFcn.m

%%
% The function has many other options, such as customizing the organization
% name and the copyright year. Mirko describes in detail the modifications
% to Raymond's entry, but here are some of the ones I like:
%
% * _*Copyright line is added either before $Revision keyword or after a
% blank line.*_ MATLAB files shipped with the product all contain revision
% information (edit any MATLAB function). But most of my files don't have a
% "$Revision" line, so I like the fact that it looks for a blank line.
% * _*Ability to have multiple copyrights with different organizations.*_
% If the file already contains a copyright, calling the function with a
% different organization name appends a new copyright line. This is useful
% when I am updating a file written by someone else from a different
% organization.
% * _*Automatic update of multi-year copyrights.*_ If the file already
% contains "Copyright 2009", then calling it again with 2011 will change it
% to "Copyright 2009-2011".
% * _*Support for command syntax.*_
% <http://www.mathworks.com/help/techdoc/ref/syntax.html#f76-1098266
% Command syntax> is useful when appropriate, and I think it's quite
% appropriate here. My examples above use command syntax. Compare this with
% the function syntax: |addcopyright('myFcn.m')|
% * _*Ability to remove copyright line.*_ It's always nice to be able to
% undo the process.
% * _*Ability to add copyright to a single file (as opposed to all files
% inside folders).*_ Sometimes, I just want to update a single file within
% a folder, so this is quite useful for me.
%
% Thanks Mirko for this useful entry!
%
% *Comments*
%
% Give this a try and let us know what you think
% <http://blogs.mathworks.com/pick/?p=3056#respond here> or leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/16441#comments
% comment> for Mirko.
%
% Oh, and I wish everyone a great new upcoming year!

%   Copyright 2011 The MathWorks, Inc.
##### SOURCE END ##### 3f28cad08a7d4a7c8c0d69a9c19f4988
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2011/12/30/automatically-add-copyright-information-to-your-matlab-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Get Information About Your Computer</title>
		<link>http://blogs.mathworks.com/pick/2011/12/23/get-information-about-your-computer/</link>
		<comments>http://blogs.mathworks.com/pick/2011/12/23/get-information-about-your-computer/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 13:41:34 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3038</guid>
		<description><![CDATA[Brett's Pick this week is CPU Info by Ben Tordoff. Today's is a quick-Pick, to go with our holiday greetings. Occasionally, you might want to know some hard-to-find information about your computer. You could spend some time digging around in your documentation, or you could simply download and run Ben's CPU Info file. More important [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/33155-cpu-info">CPU Info</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/80363">Ben Tordoff</a>.
   </p>
   <p>Today's is a quick-Pick, to go with our holiday greetings.</p>
   <p>Occasionally, you might want to know some hard-to-find information about your computer. You could spend some time digging
      around in your documentation, or you could simply download and run Ben's CPU Info file. More important than just the information
      that Ben has elected to write out is that you can readily modify his code to extract all kinds of additional information.
      Unmodified, his function returns information like this:
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">myComputerInfo = cpuinfo
myComputerInfo.Name</pre><pre style="font-style:oblique">myComputerInfo = 
             Name: [1x40 char]
            Clock: '2701 MHz'
            Cache: '256 KB'
    NumProcessors: 2
           OSType: 'Windows'
        OSVersion: [1x30 char]
ans =
Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
</pre><p></p><p>It doesn't get easier than that!</p>
   <p>Thanks, Ben, and Happy Holidays, everyone! Looking forward to a great 2012!</p>
   <p>As always, <a href="http://blogs.mathworks.com/pick/?p=3038#respond">comments to this blog post</a> are welcome. Or leave a comment for Ben <a href="http://www.mathworks.com/matlabcentral/fileexchange/33155#comments">here</a>.
   </p><script language="JavaScript">
<!--

    function grabCode_8dad9a0f81ad43438170b3b5f8dc466e() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='8dad9a0f81ad43438170b3b5f8dc466e ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 8dad9a0f81ad43438170b3b5f8dc466e';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2011 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_8dad9a0f81ad43438170b3b5f8dc466e()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
8dad9a0f81ad43438170b3b5f8dc466e ##### SOURCE BEGIN #####
%% Get Information About Your Computer
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/33155-cpu-info CPU Info> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/80363 Ben Tordoff>.

%%
% Today's is a quick-Pick, to go with our holiday greetings.

%%
% Occasionally, you might want to know some hard-to-find
% information about your computer. You could spend some time
% digging around in your documentation, or you could simply
% download and run Ben's CPU Info file. More important than
% just the information that Ben has elected to write out is
% that you can readily modify his code to extract all kinds
% of additional information. Unmodified, his function
% returns information like this:
%
%%
myComputerInfo = cpuinfo
myComputerInfo.Name


%%
%
% It doesn't get easier than that!

%%
% Thanks, Ben, and Happy Holidays, everyone! Looking forward to a great 2012!

%% 
% As always, <http://blogs.mathworks.com/pick/?p=3038#respond comments to this blog post> are welcome. Or leave a
% comment for Ben <http://www.mathworks.com/matlabcentral/fileexchange/33155#comments here>.
##### SOURCE END ##### 8dad9a0f81ad43438170b3b5f8dc466e
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2011/12/23/get-information-about-your-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulink for Natural Interaction Device</title>
		<link>http://blogs.mathworks.com/pick/2011/12/16/simulink-for-natural-interaction-device/</link>
		<comments>http://blogs.mathworks.com/pick/2011/12/16/simulink-for-natural-interaction-device/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 14:08:09 +0000</pubDate>
		<dc:creator>Guest Picker</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3011</guid>
		<description><![CDATA[Doug's pick this week is Simulink for Natural Interaction Device by Takashi Chikamasa. Although I work at a software company my background is in mechanical engineering, so I'm a sucker for hardware. You might have seen the work I did to link Simulink with the Arduino platform. Needless to say, I was pretty excited when [...]]]></description>
			<content:encoded><![CDATA[<a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/62957">Doug</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/32318">Simulink for Natural Interaction Device</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/68132">Takashi Chikamasa</a>.
<p><p>
Although I work at a software company my background is in mechanical engineering, so I'm a sucker for hardware. You might have seen the <a href="http://www.mathworks.com/matlabcentral/fileexchange/30277">work I did</a> to link Simulink with the Arduino platform. Needless to say, I was pretty excited when I saw Takashi, my colleague in our Japanese office, demonstrate this submission which allows you to connect a natural interaction device (NID) like Microsoft's Kinect or ASUS's X-tion Pro to Simulink. He has built a library of Simulink blocks that let you pull in data from an NID plugged into your computer's USB port. The interface is built on <a href="http://www.openni.org/">OpenNI</a>'s existing library, but allows you to leverage <a href="http://www.mathworks.com/products/simulink">Simulink</a> and other products like the <a href="http://www.mathworks.com/products/computer-vision">Computer Vision System Toolbox</a> to quickly build some advanced algorithms to interperet your gestures or motion.
<p><p>
Unfortunately I don't have an NID (yet) so I haven't been able to try it out myself, but I have seen it demonstrated and was impressed with what could be done. The submission includes a library of basic blocks that allow you to acquire video, depth map, infrared data, motion information, and the location of joints in a skeleton:
<p><p>
<center><a href="http://blogs.mathworks.com/pick/files/pick_01.png"><img src="http://blogs.mathworks.com/pick/files/pick_01.png" alt="" width="322" height="600" /></a></center>
<p><p>
The submission also includes a couple of example models so you can get up and running quickly (click to enlarge):
<p><p>
<center><a href="http://blogs.mathworks.com/pick/files/pick_02.png"><img src="http://blogs.mathworks.com/pick/files/pick_02.png" alt="" width="600" /></a></center>
<p><p>
<strong>Comments</strong>
<p><p>
If you get a chance to try it out, let me know <a href="http://blogs.mathworks.com/pick/?p=3011#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/32318#comment">comment</a> for Takashi.
<p><p>]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2011/12/16/simulink-for-natural-interaction-device/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Vivid Colormap</title>
		<link>http://blogs.mathworks.com/pick/2011/12/09/a-vivid-colormap/</link>
		<comments>http://blogs.mathworks.com/pick/2011/12/09/a-vivid-colormap/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 14:10:13 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=3001</guid>
		<description><![CDATA[Jiro's pick this week is Vivid Colormap by Joseph Kirk. Good uses of colors can help convey ideas effectively. It can help you accentuate certain concepts. Or you may need to use a gradient color that translates well when printed in gray scale. Joseph's entry really caught my attention. As the name suggests, it produces [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/20848">Vivid Colormap</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/90537">Joseph Kirk</a>.
   </p>
   <p>Good uses of colors can help convey ideas effectively. It can help you accentuate certain concepts. Or you may need to use
      a gradient color that translates well when printed in gray scale. Joseph's entry really caught my attention. As the name suggests,
      it produces quite a vivid colormap. The idea is ingenious; he creates a gradient within each color, and that produces an accent
      at each level.
   </p>
   <p>Let's see how it works. We'll first create a blue and red diverging color map, which gradually changes from blue to red with
      white in the center. We'll use the <a href="http://www.mathworks.com/help/techdoc/ref/peaks.html"><tt>peaks</tt></a> function as the sample image.
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)"><span style="color: #228B22">% Create 13-level blue/red diverging color map:</span>
level = 13; n = ceil(level/2);
cmap1 = [linspace(1, 1, n); linspace(0, 1, n); linspace(0, 1, n)]';
cmap2 = [linspace(1, 0, n); linspace(1, 0, n); linspace(1, 1, n)]';
cmap = [cmap1; cmap2(2:end, :)];

imagesc(peaks(500));
colormap(vivid(cmap)); caxis([-8 8]);
colorbar</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_vivid_colormap/potw_vivid_colormap_01.png"> <p>Notice how vivid it looks! <tt>vivid</tt> also has additional options to change the level of gradients.
   </p>
   <p>Less vivid:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">colormap(vivid(cmap, [.4, .6]));</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_vivid_colormap/potw_vivid_colormap_02.png"> <p>More vivid:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">colormap(vivid(cmap, [0, 1]));</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_vivid_colormap/potw_vivid_colormap_03.png"> <p>You can also get the regular colormap behavior:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">colormap(vivid(cmap, [.5 .5]));</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_vivid_colormap/potw_vivid_colormap_04.png"> <p><b>More on Colormaps</b></p>
   <p>As I was writing this post, I learned quite a bit about colormaps. MATLAB has a set of standard colormaps described <a href="http://www.mathworks.com/help/techdoc/ref/colormap.html#f19-357282">here</a>. There are a few File Exchange entries that create additional colormaps, such as <a href="http://www.mathworks.com/matlabcentral/fileexchange/34087"><tt>cbrewer</tt></a>, <a href="http://www.mathworks.com/matlabcentral/fileexchange/30564"><tt>othercolor</tt></a>, and <a href="http://www.mathworks.com/matlabcentral/fileexchange/28943">Color Palette Tables</a>. There are also colormaps that would look nice when printed on a grayscale printer - <a href="http://www.mathworks.com/matlabcentral/fileexchange/11037">Lab color scale</a> and <a href="http://www.mathworks.com/matlabcentral/fileexchange/12804"><tt>colorGray</tt></a>.
   </p>
   <p>I also found a couple of entries that would have helped me with creating the blue/red diverging colormap - <a href="http://www.mathworks.com/matlabcentral/fileexchange/4058"><tt>bluewhitered</tt></a> and <a href="http://www.mathworks.com/matlabcentral/fileexchange/17552"><tt>makeColorMap</tt></a>.
   </p>
   <p><b>Comments</b></p>
   <p>Check out all the File Exchange entries on <a href="http://www.mathworks.com/matlabcentral/fileexchange/?term=colormap">colormaps</a>! If you have your favorite colormap, let us know <a href="http://blogs.mathworks.com/pick/?p=3001#respond">here</a> or try Joseph's <tt>vivid</tt> and leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/20848#comments">comment</a> for him.
   </p><script language="JavaScript">
<!--

    function grabCode_3558e39145e5486ca9cf6b95ea84c18f() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='3558e39145e5486ca9cf6b95ea84c18f ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 3558e39145e5486ca9cf6b95ea84c18f';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Jiro Doke';
        copyright = 'Copyright 2011 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_3558e39145e5486ca9cf6b95ea84c18f()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
3558e39145e5486ca9cf6b95ea84c18f ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/20848 Vivid
% Colormap> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/90537 Joseph
% Kirk>.
%
% Good uses of colors can help convey ideas effectively. It can help you
% accentuate certain concepts. Or you may need to use a gradient color that
% translates well when printed in gray scale. Joseph's entry really caught
% my attention. As the name suggests, it produces quite a vivid colormap.
% The idea is ingenious; he creates a gradient within each color, and that
% produces an accent at each level.
%
% Let's see how it works. We'll first create a blue and red diverging color
% map, which gradually changes from blue to red with white in the center.
% We'll use the <http://www.mathworks.com/help/techdoc/ref/peaks.html
% |peaks|> function as the sample image.

% Create 13-level blue/red diverging color map:
level = 13; n = ceil(level/2);
cmap1 = [linspace(1, 1, n); linspace(0, 1, n); linspace(0, 1, n)]';
cmap2 = [linspace(1, 0, n); linspace(1, 0, n); linspace(1, 1, n)]';
cmap = [cmap1; cmap2(2:end, :)];

imagesc(peaks(500));
colormap(vivid(cmap)); caxis([-8 8]);
colorbar

%%
% Notice how vivid it looks! |vivid| also has additional options to change
% the level of gradients.
%
% Less vivid:

colormap(vivid(cmap, [.4, .6]));

%%
% More vivid:

colormap(vivid(cmap, [0, 1]));

%%
% You can also get the regular colormap behavior:

colormap(vivid(cmap, [.5 .5]));

%%
% *More on Colormaps*
%
% As I was writing this post, I learned quite a bit about colormaps. MATLAB
% has a set of standard colormaps described
% <http://www.mathworks.com/help/techdoc/ref/colormap.html#f19-357282
% here>. There are a few File Exchange entries that create additional
% colormaps, such as
% <http://www.mathworks.com/matlabcentral/fileexchange/34087 |cbrewer|>,
% <http://www.mathworks.com/matlabcentral/fileexchange/30564 |othercolor|>,
% and <http://www.mathworks.com/matlabcentral/fileexchange/28943 Color
% Palette Tables>. There are also colormaps that would look nice when
% printed on a grayscale printer -
% <http://www.mathworks.com/matlabcentral/fileexchange/11037 Lab color
% scale> and <http://www.mathworks.com/matlabcentral/fileexchange/12804
% |colorGray|>.
%
% I also found a couple of entries that would have helped me with creating
% the blue/red diverging colormap -
% <http://www.mathworks.com/matlabcentral/fileexchange/4058 |bluewhitered|>
% and <http://www.mathworks.com/matlabcentral/fileexchange/17552
% |makeColorMap|>.
%
% *Comments*
%
% Check out all the File Exchange entries on
% <http://www.mathworks.com/matlabcentral/fileexchange/?term=colormap
% colormaps>! If you have your favorite colormap, let us know
% <http://blogs.mathworks.com/pick/?p=3001#respond here> or try Joseph's
% |vivid| and leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/20848#comments
% comment> for him.

##### SOURCE END ##### 3558e39145e5486ca9cf6b95ea84c18f
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2011/12/09/a-vivid-colormap/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Will my flow be turbulent?</title>
		<link>http://blogs.mathworks.com/pick/2011/12/02/will-my-flow-be-turbulent/</link>
		<comments>http://blogs.mathworks.com/pick/2011/12/02/will-my-flow-be-turbulent/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 14:20:44 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=2948</guid>
		<description><![CDATA[Brett's Pick this week is Moody, by Tom Davis. I am not a mechanical engineer, though I did study fluid mechanics in my biomedical engineering past. In fluid flows, the Reynolds number is a dimensionless parameter that describes the ratio of inertial to viscous forces. This relationship is significant because, among other things, it can [...]]]></description>
			<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/7747-moody-diagram">Moody,</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/18628">Tom Davis</a>.
   </p>
   <p>I am not a mechanical engineer, though I did study fluid mechanics in my biomedical engineering past. In fluid flows, the
      <a href="http://en.wikipedia.org/wiki/Reynolds_number">Reynolds number</a> is a dimensionless parameter that describes the ratio of inertial to viscous forces. This relationship is significant because,
      among other things, it can be used to predict the nature of the flow--whether laminar or turbulent. In biomechanics, fully
      developed fluid flows are typically of low Reynolds numbers, certainly below the critical threshold at which flow becomes
      turbulent.
   </p>
   <p>However, in classical mechanics and hydraulics, flows are typically through long, often rigid, pipes. Flows become "fully
      developed," and can be of much higher Reynolds numbers. In these regimes, assuming one knows the characteristics of the pipe,
      one can calculate the <a href="http://en.wikipedia.org/wiki/Darcy_friction_factor">Darcy friction factor</a> to determine the (pressure) head loss during flow.
   </p>
   <p>Okay, geeking out a bit. The relevance here is that the interplay of Reynolds numbers and Darcy factors can be difficult to
      deal with; <a href="http://en.wikipedia.org/wiki/Moody_diagram">Moody diagrams</a> allow us to relate the two graphically, and to see at a glance whether, given a Darcy Factor and a Reynolds number,  flow
      will be laminar or turbulent for pipes of a specified roughness.
   </p>
   <p>Creating a Moody diagram is no trivial task, though. Or at least, it wasn't until Tom shared his MATLAB code for creating
      one. Function 'Moody' allows you to specify units (SI or Imperial) and paper size (A4 or Letter), and the name of an output
      file, and it will create a beautiful Moody diagram for you!
   </p>
   <p><img vspace="5" hspace="5" src="http://www.mathworks.com/matlabcentral/fx_files/7747/1/moody.png"> </p>
   <p>Thanks for sharing that, Tom! As always, <a href="http://blogs.mathworks.com/pick/?p=2948#respond">comments to this blog post</a> are welcome. Or leave a comment for Tom <a href="http://www.mathworks.com/matlabcentral/fileexchange/7747-moody-diagram#comments">here</a>.
   </p><script language="JavaScript">
<!--

    function grabCode_f03c6c08bdaf4303811bde78eb669c4c() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='f03c6c08bdaf4303811bde78eb669c4c ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' f03c6c08bdaf4303811bde78eb669c4c';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2011 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_f03c6c08bdaf4303811bde78eb669c4c()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; 7.13<br /></p>
</div>
<!--
f03c6c08bdaf4303811bde78eb669c4c ##### SOURCE BEGIN #####
%% Will my flow be turbulent?
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/7747-moody-diagram Moody,> by 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/18628 Tom Davis>.

%%
% I am not a mechanical engineer, though I did study fluid
% mechanics in my biomedical engineering past. In fluid
% flows, the <http://en.wikipedia.org/wiki/Reynolds_number Reynolds number>
% is a dimensionless parameter that describes the ratio of
% inertial to viscous forces. This relationship is significant because,
% among other things, it can be used to predict the
% nature of the flowREPLACE_WITH_DASH_DASHwhether laminar or turbulent. In
% biomechanics, fully developed fluid flows are typically of
% low Reynolds numbers, certainly below the critical
% threshold at which flow becomes turbulent.

%%
% However, in classical mechanics and hydraulics, flows are typically through
% long, often rigid, pipes. Flows become "fully developed,"
% and can be of much higher Reynolds numbers. In these
% regimes, assuming one knows the characteristics of the
% pipe, one can calculate the <http://en.wikipedia.org/wiki/Darcy_friction_factor Darcy friction factor> to 
% determine the (pressure) head loss during flow. 

%% 
% Okay, geeking out a bit. The relevance here is that the
% interplay of Reynolds numbers and Darcy factors can be
% difficult to deal with;
% <http://en.wikipedia.org/wiki/Moody_diagram Moody diagrams> allow us to relate the two graphically, and to
% see at a glance whether, given a Darcy Factor and a Reynolds number,  flow will be laminar or turbulent for pipes of a specified roughness.

%%
% Creating a Moody diagram is no trivial task, though. Or at
% least, it wasn't until Tom shared his MATLAB code for
% creating one. Function 'Moody' allows you to specify units
% (SI or Imperial) and paper size (A4 or Letter), and the
% name of an output file, and it will create a beautiful
% Moody diagram for you!

%%
% 
% <<http://www.mathworks.com/matlabcentral/fx_files/7747/1/moody.png>>
% 

%% 
% Thanks for sharing that, Tom! As always, <http://blogs.mathworks.com/pick/?p=2948#respond comments to this blog post> are welcome. Or leave a
% comment for Tom
% <http://www.mathworks.com/matlabcentral/fileexchange/7747-moody-diagram#comments here>.

##### SOURCE END ##### f03c6c08bdaf4303811bde78eb669c4c
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2011/12/02/will-my-flow-be-turbulent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

