help to make a curve onli with to vectorts

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

help to make a curve onli with to vectorts

linuxnero
i have x= [01 2 3 4]
and
y= [0 10 15 20]
y want a graph like a curve but i can not



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

Doug Stewart-4


On Sat, Dec 15, 2018 at 10:40 AM linuxnero <[hidden email]> wrote:
i have x= [01 2 3 4]
and
y= [0 10 15 20]
y want a graph like a curve but i can not



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


try
x= [01 2 3 4]
y= [0 10 15 20]
plot(x,y)


--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

linuxnero
of course but that graph a straight lines
but i want a curve




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

Doug Stewart-4


On Sat, Dec 15, 2018 at 10:58 AM linuxnero <[hidden email]> 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)

--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

Doug Stewart-4


On Sat, Dec 15, 2018 at 11:05 AM Doug Stewart <[hidden email]> wrote:


On Sat, Dec 15, 2018 at 10:58 AM linuxnero <[hidden email]> 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)


I assumed you wanted a polynomial fit, but is you want
some other curve then there are lots of ways to get them.
Doug 



Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

Montgomery-Smith, Stephen
In reply to this post by Doug Stewart-4
Did you mean x2 = 1:.1:4 ?
From: Help-octave <help-octave-bounces+stephen=[hidden email]> on behalf of Doug Stewart <[hidden email]>
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 <[hidden email]> 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)

--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

marco atzeri-2
In reply to this post by linuxnero
Am 15.12.2018 um 16:21 schrieb linuxnero:
> i have x= [01 2 3 4]
> and
> y= [0 10 15 20]
> y want a graph like a curve but i can not
>

what is the problem with

plot(x,y);

?

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Reply | Threaded
Open this post in threaded view
|

Re: help to make a curve onli with to vectorts

Juan Pablo Carbajal-2
In reply to this post by Montgomery-Smith, Stephen
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
<[hidden email]> wrote:

>
> Did you mean x2 = 1:.1:4 ? ________________________________
> From: Help-octave <help-octave-bounces+stephen=[hidden email]> on behalf of Doug Stewart <[hidden email]>
> 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 <[hidden email]> 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
>
>