help-octave
[Top][All Lists]
Advanced

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

Re: help to make a curve onli with to vectorts


From: Juan Pablo Carbajal
Subject: Re: help to make a curve onli with to vectorts
Date: Sat, 15 Dec 2018 18:44:54 +0100

Hi,
doug gave you the answer. With a finite amount of points the only way
to get a smooth curve is with interpolation.
You can use the function interp1 to test different kinds of
interpolants. See 'help interp1' to know details.
Example with splines

pp = interp1 (x, y, 'spline', 'pp');
x_ = linspace (min(x), max(x), 100).'; % desired points to plot curve
y_ = ppval (pp, x_);
plot (x_,y_,'-', x, y, 'o')
legend ('curve', 'data', 'location', 'northwest')


On Sat, Dec 15, 2018 at 5:30 PM Montgomery-Smith, Stephen
<address@hidden> wrote:
>
> Did you mean x2 = 1:.1:4 ? ________________________________
> From: Help-octave <address@hidden> on behalf of Doug Stewart <address@hidden>
> Sent: Saturday, December 15, 2018 10:05:48 AM
> To: linuxnero
> Cc: Help GNU Octave
> Subject: Re: help to make a curve onli with to vectorts
>
>
>
> On Sat, Dec 15, 2018 at 10:58 AM linuxnero <address@hidden> wrote:
>>
>> of course but that graph a straight lines
>> but i want a curve
>>
>>
>>
>
> Try this
> x= [01 2 3 4]
> y= [0 10 15 20]
>
> plot(x,y)
> hold on
> p=polyfit(x,y,3)
> x2=0:.1:5;
> y1=polyval(p,x2)
> plot(x2,y1)
>
> --
> DAS
>
>



reply via email to

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