help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple plots


From: Søren Hauberg
Subject: Re: Multiple plots
Date: Wed, 18 Jul 2007 13:33:13 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070604)

If you use 'hold' simple do something like

hold on
for i = 1:length(N)
  X = linspace(0, l, N(i))/lambda;
  Y = f(X, N(i)); % I don't know how this line looks,
                  % as it depends on how 'f' is declared.
  plot(X, Y);
endfor
hold off

I don't think you can do something like this by plotting a matrix.

Søren

P.S. A good way to figure these things out, is just to try it at the Octave prompt. Sure, you'll get some errors once in a while, but they don't hurt anybody :-)

asha g skrev:
The x axis is x = linspace(0,l,N)
X = x/lambda So as N varies, X varies. How do you put that on one
plot?
Asha --- Søren Hauberg <address@hidden> wrote:

I don't quite understand your problem. You can use
the 'hold' command to plot several plots on one figure. The code for this looks something like this:

figure
hold on
for N = 10: 10: 40
   plot(f(N), Y)
endfor
hold off

or you can put all your data in a matrix and then
plot that matrix. This would look something like this

N = 10: 10: 40;
data = zeros(length(X), length(N));
for i = 1:length(N)
   data(:, i) = f(N(i));
endfor
plot(data)

I haven't tested any of the above code, but
something similar to the two examples should work for you.

Søren


asha g skrev:
Could someone tell me what the command is for
multiple
plots. Basically I have N = 10: 10: 40
I am plotting a fn X vs Y for the various values
of N
and  would like them to be in the same plot
ideally
but I get an error message for that as X = f(N).
So I would like to plot it in subplots.

I tried mplot(X,Y) but I get an error message :
'mplot' undefined.

thanks
Asha Goals too clearly defined can become blinkers. Mary Catherine Bateson


____________________________________________________________________________________
Building a website is a piece of cake. Yahoo!
Small Business gives you all the tools to get
online.
http://smallbusiness.yahoo.com/webhosting _______________________________________________
Help-octave mailing list
address@hidden

https://www.cae.wisc.edu/mailman/listinfo/help-octave


Goals too clearly defined can become blinkers. Mary Catherine Bateson


____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC


reply via email to

[Prev in Thread] Current Thread [Next in Thread]