Comments on: Solution to MATLAB Graphics challenge for new users (1/2) https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Thu, 17 Nov 2016 15:46:19 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Jose Sanabria https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2637 Tue, 10 May 2011 14:46:46 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2637 Thanks Doug. NaN does the trick indeed in your code. Whether we are needing to represent a dual color graph with other colors than the MATLAB defaults, I suggest this modified version:

function createDualColorPlot(x, y, lev)
    [yHigh, yLow] = FilterY(y,lev);
    cox = [0.58 0.39 0.39];
    coz = [0.23 0.44 0.34];
    plot(x,yHigh,'Color',cox,'LineWidth',2);
    hold on
    plot(x,yLow,'Color',coz,'LineWidth',2);
    hold off
    xlimits = xlim;
    line(xlimits,[lev lev],'Color','k');

The emphasis in the lines can be useful to give prominence some pieces of the graph.

]]>
By: Pezhman https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2599 Tue, 12 Apr 2011 20:07:27 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2599 “Edit Run Configuration” is awesome!

One thing about the code. I did this part, but I was getting “bad” graphs whenever x was too coarse or I had more than one period. Here is my code:

function h = dualColorPlot(x, y, lev)
Ind_LowY = find(y=lev);

LowY = y(Ind_LowY);
LowX = x(Ind_LowY);
HighY = y(Ind_HighY);
HighX = x(Ind_HighY);

h = plot(LowX, LowY, 'b', HighX, HighY, 'r')

I think NaN does the trick. Thank you Doug!

]]>
By: dhull https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2597 Fri, 08 Apr 2011 18:10:53 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2597 @Everyone,

Glad the advanced users are learning something from these videos also. The File Exchange file looks good. You even did the interpolation near the line. I cover that in my language class, it is kind of fiddly, and not really the point of this exercise, so I only assign that to the people that get done early! :)

]]>
By: Peter https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2596 Fri, 08 Apr 2011 17:16:11 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2596 The “Edit run configuration” is new to me as well and sounds like I will use it a lot — starting now :-)
Thank you!

]]>
By: Matt Fig https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2595 Fri, 08 Apr 2011 15:39:57 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2595 Hello Doug,

This topic inspired me to develop a new FEX submission, LINECMENU. Thanks for the inspiration!

]]>
By: Paulo Silva https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2593 Fri, 08 Apr 2011 15:04:24 +0000 https://blogs.mathworks.com/videos/2011/04/08/solution-to-matlab-graphics-challenge-for-new-users-12/#comment-2593 Very nice tutorial, I was wondering how you were running the function without calling it from another script or workspace until you explained the Edit Run Configuration part, that’s something I never used before, keep up the good work Doug.

]]>