http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144
MATLAB Central Newsreader  Plotting max and min
Feed for thread: Plotting max and min
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Thu, 18 Feb 2010 18:50:05 +0000
Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#718987
Julian
Hello all,<br>
I must be going through a long day, because I am stumped on something that I think should be very minute. However, I am trying to plot multiple plots in my graph with no success. This is a snippet of my code. More or less this is the end of my code.<br>
<br>
data1 = var1var2<br>
lower = min(data1);<br>
upper = max(data1);<br>
avg = mean(data1);<br>
<br>
plot(data1,'r*')<br>
hold on<br>
plot(upper,'m.')<br>
plot(lower,'y.')<br>
plot(avg,'g.')<br>
<br>
Now, I plot the first point, plot(data1,'r*') no problem. And I do realize I can just go to Data statistics to find out the max, min, etc. But I want this code to be as automatic as I can. With that said, I have to say, I seem to not seem to know my basics today. Any help would be appreciated.

Thu, 18 Feb 2010 19:04:22 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#718995
Sadik
How about<br>
<br>
plot(data1,'r*')<br>
hold on<br>
plot(upper*ones(size(data1)),'m.')<br>
plot(lower*ones(size(data1)),'y.')<br>
plot(avg*ones(size(data1)),'g.')<br>
<br>
<br>
"Julian " <sadsd@aol.com> wrote in message <hlk24t$3g3$1@fred.mathworks.com>...<br>
> Hello all,<br>
> I must be going through a long day, because I am stumped on something that I think should be very minute. However, I am trying to plot multiple plots in my graph with no success. This is a snippet of my code. More or less this is the end of my code.<br>
> <br>
> data1 = var1var2<br>
> lower = min(data1);<br>
> upper = max(data1);<br>
> avg = mean(data1);<br>
> <br>
> plot(data1,'r*')<br>
> hold on<br>
> plot(upper,'m.')<br>
> plot(lower,'y.')<br>
> plot(avg,'g.')<br>
> <br>
> Now, I plot the first point, plot(data1,'r*') no problem. And I do realize I can just go to Data statistics to find out the max, min, etc. But I want this code to be as automatic as I can. With that said, I have to say, I seem to not seem to know my basics today. Any help would be appreciated.

Thu, 18 Feb 2010 19:09:45 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#718998
TideMan
On Feb 19, 7:50 am, "Julian " <sa...@aol.com> wrote:<br>
> Hello all,<br>
> I must be going through a long day, because I am stumped on something that I think should be very minute. However, I am trying to plot multiple plots in my graph with no success. This is a snippet of my code. More or less this is the end of my code.<br>
><br>
> data1 = var1var2<br>
> lower = min(data1);<br>
> upper = max(data1);<br>
> avg = mean(data1);<br>
><br>
> plot(data1,'r*')<br>
> hold on<br>
> plot(upper,'m.')<br>
> plot(lower,'y.')<br>
> plot(avg,'g.')<br>
><br>
> Now, I plot the first point, plot(data1,'r*') no problem. And I do realize I can just go to Data statistics to find out the max, min, etc. But I want this code to be as automatic as I can. With that said, I have to say, I seem to not seem to know my basics today. Any help would be appreciated.<br>
<br>
What is the abscissa?<br>
You need to define one.<br>
Even x=[1:length(data1)]'; would do.<br>
Then:<br>
> plot(x,data1,'r*')<br>
> hold on<br>
> plot(x,upper*ones(length(x),1),'m.')<br>
or<br>
plot([x(1) x(end)],[upper upper],'m')<br>
<br>
etc

Thu, 18 Feb 2010 19:27:02 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#719003
Julian
Sadik and TideMan,<br>
Thank you both for your inputs. Both solutions provided were correct and worked very well. <br>
<br>
TideMan,<br>
That was very crafty to think of defining an abscissa first. I honestly didn't think of doing that because my script basically takes from a file, searches through it and plots a truth from two user defined points. I would assume, the starting point that the user defines would be used as a started to plot. I think I would've thought of Sadiks method before I thought of yours. I appreciate your method. Gives me a great direction to think of.<br>
<br>
Sadik, can't leave you out. Thank you for input as well.<br>
<br>
Thanks to you both for your swift responses. <br>
<br>
TideMan <mulgor@gmail.com> wrote in message <367f375f670541e8a9e51a0d80ff250e@b7g2000pro.googlegroups.com>...<br>
> On Feb 19, 7:50 am, "Julian " <sa...@aol.com> wrote:<br>
> > Hello all,<br>
> > I must be going through a long day, because I am stumped on something that I think should be very minute. However, I am trying to plot multiple plots in my graph with no success. This is a snippet of my code. More or less this is the end of my code.<br>
> ><br>
> > data1 = var1var2<br>
> > lower = min(data1);<br>
> > upper = max(data1);<br>
> > avg = mean(data1);<br>
> ><br>
> > plot(data1,'r*')<br>
> > hold on<br>
> > plot(upper,'m.')<br>
> > plot(lower,'y.')<br>
> > plot(avg,'g.')<br>
> ><br>
> > Now, I plot the first point, plot(data1,'r*') no problem. And I do realize I can just go to Data statistics to find out the max, min, etc. But I want this code to be as automatic as I can. With that said, I have to say, I seem to not seem to know my basics today. Any help would be appreciated.<br>
> <br>
> What is the abscissa?<br>
> You need to define one.<br>
> Even x=[1:length(data1)]'; would do.<br>
> Then:<br>
> > plot(x,data1,'r*')<br>
> > hold on<br>
> > plot(x,upper*ones(length(x),1),'m.')<br>
> or<br>
> plot([x(1) x(end)],[upper upper],'m')<br>
> <br>
> etc

Thu, 18 Feb 2010 19:27:02 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#719004
Julian
Sadik and TideMan,<br>
Thank you both for your inputs. Both solutions provided were correct and worked very well. <br>
<br>
TideMan,<br>
That was very crafty to think of defining an abscissa first. I honestly didn't think of doing that because my script basically takes from a file, searches through it and plots a truth from two user defined points. I would assume, the starting point that the user defines would be used as a started to plot. I think I would've thought of Sadiks method before I thought of yours. I appreciate your method. Gives me a great direction to think of.<br>
<br>
Sadik, can't leave you out. Thank you for input as well.<br>
<br>
Thanks to you both for your swift responses. <br>
<br>
TideMan <mulgor@gmail.com> wrote in message <367f375f670541e8a9e51a0d80ff250e@b7g2000pro.googlegroups.com>...<br>
> On Feb 19, 7:50 am, "Julian " <sa...@aol.com> wrote:<br>
> > Hello all,<br>
> > I must be going through a long day, because I am stumped on something that I think should be very minute. However, I am trying to plot multiple plots in my graph with no success. This is a snippet of my code. More or less this is the end of my code.<br>
> ><br>
> > data1 = var1var2<br>
> > lower = min(data1);<br>
> > upper = max(data1);<br>
> > avg = mean(data1);<br>
> ><br>
> > plot(data1,'r*')<br>
> > hold on<br>
> > plot(upper,'m.')<br>
> > plot(lower,'y.')<br>
> > plot(avg,'g.')<br>
> ><br>
> > Now, I plot the first point, plot(data1,'r*') no problem. And I do realize I can just go to Data statistics to find out the max, min, etc. But I want this code to be as automatic as I can. With that said, I have to say, I seem to not seem to know my basics today. Any help would be appreciated.<br>
> <br>
> What is the abscissa?<br>
> You need to define one.<br>
> Even x=[1:length(data1)]'; would do.<br>
> Then:<br>
> > plot(x,data1,'r*')<br>
> > hold on<br>
> > plot(x,upper*ones(length(x),1),'m.')<br>
> or<br>
> plot([x(1) x(end)],[upper upper],'m')<br>
> <br>
> etc

Thu, 18 Feb 2010 19:40:10 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#719013
dpb
Julian wrote:<br>
> Hello all,<br>
> I must be going through a long day, because I am stumped on something <br>
> that I think should be very minute. However, I am trying to plot <br>
> multiple plots in my graph with no success. This is a snippet of my <br>
> code. More or less this is the end of my code.<br>
> <br>
> data1 = var1var2<br>
> lower = min(data1);<br>
> upper = max(data1);<br>
> avg = mean(data1);<br>
> <br>
> plot(data1,'r*')<br>
> hold on<br>
> plot(upper,'m.')<br>
> plot(lower,'y.')<br>
> plot(avg,'g.')<br>
> <br>
> Now, I plot the first point, plot(data1,'r*') no problem. And I do <br>
> realize I can just go to Data statistics to find out the max, min, etc. <br>
> But I want this code to be as automatic as I can. With that said, I <br>
> have to say, I seem to not seem to know my basics today. Any help would <br>
> be appreciated.<br>
<br>
Well, it's confusing when you say plot the first "point"  one would <br>
presume that should be a vector of points (plural) in order to have a <br>
line.<br>
<br>
If not, there's nothing meaningful for min,max,mean to operate on as <br>
they're all going to be identical.<br>
<br>
If is a vector (plotted as points instead of a line), then I suppose <br>
you're also looking for line() to draw the statistics. If not, you need <br>
a loop or some other way to create the first vector initially.<br>
<br>


Thu, 18 Feb 2010 20:01:19 +0000
Re: Plotting max and min
http://www.mathworks.com/matlabcentral/newsreader/view_thread/274144#719019
Julian
You're right. My terminology was wrong. You are right in assuming that what I actually meant by point was to say that it is a vector of points. I needed both the line and the numerical equivalent. <br>
<br>
Also, for my own benefit for processing data, once the maximum (line) is found (which it is thanks to tideman and sadik) I need to take the absolute value of data1 and calculate the percentage above the criteria (percentage above the max) in which, if any, points may occur. Guess that's another tangent i'm on :). Makes sense now I hope?<br>
<br>
dpb <none@non.net> wrote in message <hlk55l$839$1@news.eternalseptember.org>...<br>
> Julian wrote:<br>
> > Hello all,<br>
> > I must be going through a long day, because I am stumped on something <br>
> > that I think should be very minute. However, I am trying to plot <br>
> > multiple plots in my graph with no success. This is a snippet of my <br>
> > code. More or less this is the end of my code.<br>
> > <br>
> > data1 = var1var2<br>
> > lower = min(data1);<br>
> > upper = max(data1);<br>
> > avg = mean(data1);<br>
> > <br>
> > plot(data1,'r*')<br>
> > hold on<br>
> > plot(upper,'m.')<br>
> > plot(lower,'y.')<br>
> > plot(avg,'g.')<br>
> > <br>
> > Now, I plot the first point, plot(data1,'r*') no problem. And I do <br>
> > realize I can just go to Data statistics to find out the max, min, etc. <br>
> > But I want this code to be as automatic as I can. With that said, I <br>
> > have to say, I seem to not seem to know my basics today. Any help would <br>
> > be appreciated.<br>
> <br>
> Well, it's confusing when you say plot the first "point"  one would <br>
> presume that should be a vector of points (plural) in order to have a <br>
> line.<br>
> <br>
> If not, there's nothing meaningful for min,max,mean to operate on as <br>
> they're all going to be identical.<br>
> <br>
> If is a vector (plotted as points instead of a line), then I suppose <br>
> you're also looking for line() to draw the statistics. If not, you need <br>
> a loop or some other way to create the first vector initially.<br>
> <br>
> 