Splines

Carlo de Falco carlo.defalco at gmail.com
Wed Oct 1 05:18:36 CDT 2008


I'm typing directly to email without testing,
inline documentation of the cited functions should
help in case of typo  problems ...

On 01/ott/08, at 10:26, Kearan Mc Pherson wrote:

> I plot a 3D graph using two data.dat files like this :
>
>  d1 = load graph.dat ;
> d2 = load graph2.dat ;
> d1 = sortrows (d1);
> d2 = sortrows (d2);
>
> x = unique ([d1(:,1); d2(:,1)]);
--------
>
> y = interp1 (d1(:,1), d1(:,2), x, "cubic", "extrap");
> z = interp1 (d2(:,1), d2(:,2), x, "cubic", "extrap");
---------

whith spline this would be:

-----------
y = spline(d1(:,1), d1(:,2), x);
z = spline(d2(:,1), d2(:,2), x);
-----------

if you have the octave-forge package "splines" installed you can also  
try

-----------
ycm = ppval(catmullrom(d1(:,1), d1(:,2)), x);
zcm = ppval(catmullrom(d2(:,1), d2(:,2)), x);
-----------

use
> plot3 (x, y, z, x, ycm, zcm);

to compare the results

> I would like to use splines, can anyone please assist me regarding  
> this matter, as i'm new to octave and gnuplot. thanks and regards


c.


More information about the Help-octave mailing list