Smooth curves how to

1 view (last 30 days)
Simba Matema
Simba Matema on 15 Jul 2019
Answered: KSSV on 15 Jul 2019
Hi
got three data points and need to join them with smooth curve insted of a straight line.
please help.
commands below..
x=[1 2 3];
y=[1.22 3.31 1.91];
plot(x,y)
hold on
y1=[1.1 1.65 0.60];
plot(x,y1)
hold on
y2=[1.22 3.48 2.44];
plot(x,y2)
hold on
y3=[2.61 2.61 2.39];
plot(x,y3)
hold on
y4=[1.39 2.44 0.87]
y4 =[1.3900 2.4400 0.8700]
plot(x,y4)
hold on
y5=[0.57 0.65 0.28];
plot(x,y5)
hold on
z=[2.0 2.0 2.0];
plot(x,z)

Accepted Answer

KSSV
KSSV on 15 Jul 2019
x=[1 2 3];
y=[1.22 3.31 1.91];
xx = min(x):0.1:max(x);
yy = spline(x,y,xx);
plot(x,y,'r',xx,yy,'b')

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!