【曲线平滑方法】SmoothLine.曲线平滑

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoxiao133/article/details/87966080

应用中经常需要平滑曲线,因此使用这个函数就可以方便的平滑,也是可以使用matlab自带smooth的命令。但是matlab没有smoothCurve平滑的好。
代码(不公开)链接:https://github.com/XiaoGongWei/StoreData_Private/blob/master/SmoothLine.zip
公开代码:https://download.csdn.net/download/xiaoxiao133/10977844
Matlab代码,输入一个Y输出smooth后的Y,适用如下
smoothY = smoothCurve(Y);

示例代码:

x = 1:100;
A = cos(2*pi*0.05*x+2*pi*rand) + 0.5*randn(1,100);
B = smoothCurve(A);
B_1 = smooth(A);
% plot
h_plt = figure('name', 'plot data');
hold on
plot(x,A,'-o',x,B,'-x')
plot(x,B_1','r-*')
legend('Original Data','Smoothed Data', 'Matlab Smooth')

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/xiaoxiao133/article/details/87966080