Matlab数据分析练习-平滑处理

t  = linspace(0,2*pi,500);         %产生一个0到2pi的向量,长度为500
y = 100*sin(t);
noise = normrnd(0,15,1,500);        %产生随机数,符合正态分布
y = y+noise;
figure;
plot(t,y);
xlabel('t');
ylabel('y=sin(t)*noise');
title('复合信号');


%--移动平均法
yy1 = smooth(y,30);
figure;
plot(t,y,'k:');
hold on;
plot(t,yy1,'k: ','linewidth',3);
xlabel('t');
ylabel('moving');
legend('原始信号','平滑后的信号');
title('moving');

猜你喜欢

转载自blog.csdn.net/weixin_39457086/article/details/78755205