How to smooth a plot?
len1 = [25, 250, 500, 750, 1000];
for k1 = 1:length(len1)
standard_deviation1(k1) = std(resdphs(1:5000, len1(k1)));
end
f10 = [110, 100, 90, 80, 70];
figure(3),plot(f10, standard_deviation1);xlabel('frequency'); ylabel('standarddev');
grid

2 件のコメント

Adam
Adam 2015 年 8 月 11 日
Your plot seems to bear no relation to the code that comes with it.
Mayank Lakhani
Mayank Lakhani 2015 年 8 月 11 日
Hey, Adam sorry for my mistake.

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

 採用された回答

Star Strider
Star Strider 2015 年 8 月 11 日

1 投票

I’m not certain what you want to do, but you might consider experimenting with polyfit and its friends.

4 件のコメント

Mayank Lakhani
Mayank Lakhani 2015 年 8 月 11 日
I mean there shoud be no sharp edges in the curve, so it shoud be bending smoothly.
Star Strider
Star Strider 2015 年 8 月 11 日
The polyfit function can do that, as can the interp1 function with one of the nonlinear method choices, such as 'spline', 'pchip' or 'cubic'.
If you want the curve defined at more points than you measured, also use the linspace function. For example, to get a vector of 100 points over the range of your ‘f10’ vector, consider creating ‘f10_interp’ (call it what you want) as:
f10_interp = linspace(min(f10), max(f10));
then to use it with interp1:
stdev1_interp = interp1(f10, standard_deviation1, f10_interp, 'spline');
and plot it as:
plot(f10_interp, stdev1_interp)
NOTE: Since I don’t have your data, this is UNTESTED CODE.
Experiment with it to get the result you want.
Mayank Lakhani
Mayank Lakhani 2015 年 8 月 12 日
Hey Star Strider, thanks it is working :)
Star Strider
Star Strider 2015 年 8 月 12 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by