数据平滑处理

matlab可以利用smooth函数对数据进行平滑处理

%% 数据平滑处理
rng(0)
y = rand(4);
yy = smooth(y);

y1 = smooth(y,'lowess');
y2 = smooth(y,'rlowess');  % 利用rlowess方法对y进行平滑处理
y3 = smooth(y,'loess');  % 利用loess方法对y进行平滑处理
y4 = smooth(y,'sgolay',3);  % 利用sgolay方法对y进行平滑处理
f1 = figure(1);
plot(yy,'r')
hold on
plot(y1,'y*')
hold on
plot(y2,'g')
hold on
plot(y3,'b')
hold on
plot(y4,'k')
legend('yy','y1','y2','y3','y4')

%% 设置噪声
% 产生500行1列的服从N(0,15^2)分布的随机数,作为噪声信号
noise = normrnd(0,15,500,1);
t = linspace(0,2 * pi,500)';
y = 100 * sin(t);
f2 = figure(2);
plot(t,y);
ynoise = y + noise;
hold on
plot(t,ynoise,':')

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值