Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Plotting max and min Date: Thu, 18 Feb 2010 19:27:02 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 39 Message-ID: <hlk4a6$orp$1@fred.mathworks.com> References: <hlk24t$3g3$1@fred.mathworks.com> <367f375f-6705-41e8-a9e5-1a0d80ff250e@b7g2000pro.googlegroups.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1266521222 25465 172.30.248.37 (18 Feb 2010 19:27:03 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 18 Feb 2010 19:27:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1337020 Xref: news.mathworks.com comp.soft-sys.matlab:609414 Sadik and TideMan, Thank you both for your inputs. Both solutions provided were correct and worked very well. TideMan, 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. Sadik, can't leave you out. Thank you for input as well. Thanks to you both for your swift responses. TideMan <mulgor@gmail.com> wrote in message <367f375f-6705-41e8-a9e5-1a0d80ff250e@b7g2000pro.googlegroups.com>... > On Feb 19, 7:50 am, "Julian " <sa...@aol.com> wrote: > > Hello all, > > 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. > > > > data1 = var1-var2 > > lower = min(data1); > > upper = max(data1); > > avg = mean(data1); > > > > plot(data1,'r*') > > hold on > > plot(upper,'m.') > > plot(lower,'y.') > > plot(avg,'g.') > > > > 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. > > What is the abscissa? > You need to define one. > Even x=[1:length(data1)]'; would do. > Then: > > plot(x,data1,'r*') > > hold on > > plot(x,upper*ones(length(x),1),'m.') > or > plot([x(1) x(end)],[upper upper],'m-') > > etc