creating a scatter plot with smooth line for small dataset

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

 採用された回答

Birdman
Birdman 2018 年 2 月 15 日

1 投票

Use spline.
xq=1:0.01:5;
s=spline(x,y,xq);
plot(x,y,'o',xq,s,'-')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSmoothing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by