help-octave
[Top][All Lists]
Advanced

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

Re: Splines


From: Jaroslav Hajek
Subject: Re: Splines
Date: Wed, 1 Oct 2008 12:55:12 +0200

On Wed, Oct 1, 2008 at 12:44 PM, Carlo de Falco <address@hidden> wrote:
>
> On 01/ott/08, at 10:56, Jaroslav Hajek wrote:
>
>>
>> The interp1 functions *are* using splines when you specify "cubic"
>> interpolation.
>
> not really, try...
>
>>> x = sortrows (rand(10,2));
>>> xsp = linspace(min(x(:,1)), max(x(:,1)), 100);
>>> plot(x(:,1),x(:,2),'x', xsp, interp1(x(:,1), x(:,2), xsp, 'cubic'),
>>> xsp,spline(x(:,1), x(:,2), xsp))
>

OK, 'spline' was what I meant, but I think that even the 'cubic'
method uses some kind of spline, though probably it doesn't ensure
smoothness.


> I think
>
> spline(x(:,1), x(:,2), xsp)
>
> is rather equivalent to
>
> interp1(x(:,1), x(:,2), xsp, 'spline')
>
>>> norm (spline(x(:,1), x(:,2), xsp) - interp1(x(:,1), x(:,2), xsp,
>>> 'spline'), inf)
> ans = 0
>
> but the spline command gives more control on the boundary slope...
>
>>
>> To get a denser sample, you can add
>> x = linspace (min(x), max(x), 1000).';
>> or something similar after the `x = unique' line.
>>
> c.
>
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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