How can I plot a smooth curve by using discrete data?

23 ビュー (過去 30 日間)
Liton Pradhan
Liton Pradhan 2020 年 9 月 9 日
コメント済み: Liton Pradhan 2020 年 9 月 11 日
k= [1, 2, 3, 4, 5]
x= [0.00744754, 0.0622484, 0.213328, 0.509606, 1]
y= [0.794477, 0.749407, 0.736212, 0.729962, 0.726323]
z= [1.42813, 1.31861, 1.2831, 1.26558, 1.25514]
plot x, y, z w.r.t k

採用された回答

Joel Van Sickel
Joel Van Sickel 2020 年 9 月 9 日
Hello Liton,
you can use the interp functions to interpolate between your existing data points to smooth them out. To make it look like a curve, use spline interpolations: ex:
figure
knew = [1:0.01:5];
xnew = interp1(k,x,knew,'spline');
plot(k,x,'o',knew,xnew,':.');
title('Spline Interpolation');
Regards,
Joel
  3 件のコメント
Joel Van Sickel
Joel Van Sickel 2020 年 9 月 9 日
you can call it seperately for each variable for 1d plots, if you need multi-dimensional plots, you can use the same approach, but with a higher order interpolation. Start here for resources on that: https://www.mathworks.com/help/matlab/interpolation.html
Liton Pradhan
Liton Pradhan 2020 年 9 月 11 日
thank you so much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by