[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multi Column Data file to plot, gradient plot, or gradient of gradie
From: |
Paul Kienzle |
Subject: |
Re: Multi Column Data file to plot, gradient plot, or gradient of gradient plot |
Date: |
Sat, 27 Mar 2004 16:18:03 -0500 |
On Mar 26, 2004, at 1:39 PM, Timothy Milstead wrote:
I have a data file with x values in one column and corresponding y
values in
the other columns of which there are one or more.
One set of values per line.
Values separated by comma (this can be changed if need be)
z=load('datafile');
x=z(:,1);
y=z(:,2:end);
I am completely and utterly new to octave.
I usually learn a new package by example, I'm not very good at
RTFM'ing.
I would like to xy plot each column as a separate (coloured?) line and
then
xy plot the gradient of the data as lines and then finally the
gradient of
the gradient as xy plot.
subplot(311); plot(x,y);
subplot(312); plot(x(1:end-1),diff(y)./repmat(diff(x),1,columns(y)));
subplot(313);
plot(x(2:end-1),diff(y,2)./repmat(diff(x(2:end)).^2,1,columns(y)));
This is the simple formula for a gradient,
dy/dx ~= (y_i+1 - y_i) / (x_i+1 - x_i)
d2y/dx2 ~= (y_i+1 - 2y_i - y_i-1) / (x_i+1 - x_i)^2
You can come up with more sophisticated approximations.
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------