Plotting a smooth curve

3 ビュー (過去 30 日間)
Muhammadhn Muhammadh Khalid
Muhammadhn Muhammadh Khalid 2020 年 1 月 13 日
Hi there,
I know some basics of matlab, though I'm new to it. I use it only when I need any plot.
Now, I have some data points (x,y), which I have attached here. This is from my model output.
I want to import this file into matlab and plot this as a 2D plot in X,Y. The most important thing is that I need a smooth curve as in the attached figure named "Want.jpg". If I normally plot these points in MS excel, what I'm getting is shown in the figure named "Getting.jpg" and I don't want a plot like this.
Can anyone help me. Thanks in advance.
Cheers.

採用された回答

Meg Noah
Meg Noah 2020 年 1 月 13 日
編集済み: Meg Noah 2020 年 1 月 13 日
First, I added a header to the xlsx file so readtable can be used properly.
myData = readtable('Data_help.xlsx');
figure()
plot(myData.x,myData.y,'+')
hold on;
ywant = 0:0.01:1;
P = polyfit(myData.y,myData.x,6);
xwant = polyval(P,ywant);
plot(xwant,ywant)
SamplePolyfit.png
  5 件のコメント
Muhammadhn Muhammadh Khalid
Muhammadhn Muhammadh Khalid 2020 年 1 月 13 日
Oh it's the 1D interpolation. I have been looking at the documentation of 'interp'. Thanks Meg Noah.
'Smooth' seems an interesting operator. I'll look for that paper as well. Thanks.
Muhammadhn Muhammadh Khalid
Muhammadhn Muhammadh Khalid 2020 年 3 月 2 日
Hi Meg Noah, I' m trying the same thing with the attached data set. But ending up in a more curvy plot. I need a smooth plot similar, but better, than the attached figure. Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by