creating a scatter plot with smooth line for small dataset

2 vues (au cours des 30 derniers jours)
Sepanta Gharib
Sepanta Gharib le 15 Fév 2018
Commenté : Sepanta Gharib le 15 Fév 2018
I have a small dataset like this: x = [1 2 3 4 5]; y = [0.1 0.5 0.3 0.7 0.2];
I would like to plot them with a smooth line (not a straight line) like what we can do in Excel. Which command can do this?
Thanks in advance

Réponse acceptée

Birdman
Birdman le 15 Fév 2018
Use spline.
xq=1:0.01:5;
s=spline(x,y,xq);
plot(x,y,'o',xq,s,'-')

Plus de réponses (0)

Catégories

En savoir plus sur Spline Postprocessing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by