MATLAB Answers

How to make smooth curve on figure?

5 ビュー (過去 30 日間)
mk_ballav
mk_ballav 2015 年 4 月 6 日
Answered: Star Strider 2015 年 4 月 6 日
I have a matlab figure which has noisy data. I want to plot a smooth curve for those data. Can anyone help on this issue?

  0 件のコメント

サインイン to comment.

件の回答 (1)

Star Strider
Star Strider 2015 年 4 月 6 日
The Savitzky-Golay filter (Signal Processing Toolbox sgolayfilt function) is probably best for your application:
F = openfig('smooth.fig');
x = get(get(gca, 'Children'), 'XData');
y = get(get(gca, 'Children'), 'YData');
x = x(~isnan(y));
y = y(~isnan(y));
b = sgolayfilt(y, 3, fix(length(y)/2));
hold on
plot(x, b, '-r')
hold off
Experiment with the filter polynomial order and frame length to get the result you want.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。


Translated by