方波信号 随机噪声 matlab
发布网友
发布时间:2022-05-15 13:04
我来回答
共1个回答
热心网友
时间:2023-10-24 12:39
x=-8*pi:pi/15:8*pi;
y1=sin(x)+1/3*sin(3*x)+1/5*sin(5*x)+1/7*sin(7*x)+1/9*sin(9*x)+1/11*sin(11*x)+1/13*sin(13*x)+1/15*sin(15*x)+1/17*sin(17*x)+1/19*sin(19*x)+1/21*sin(21*x);
figure(1);plot(x,y1);
n=length(x);
r=0.5*(rand(n,1)-0.3);
for i=1:n
y2(i)=sin(x(i))+1/3*sin(3*x(i))+1/5*sin(5*x(i))+1/7*sin(7*x(i))+1/9*sin(9*x(i))+1/11*sin(11*x(i))+1/13*sin(13*x(i))+1/15*sin(15*x(i))+1/17*sin(17*x(i))+1/19*sin(19*x(i))+1/21*sin(21*x(i))+r(i,1);
end
figure(2);plot(x,y2);
[c,l]=wavedec(y2,3,'db1');
a3=appcoef(c,l,'db1',3);
d3=detcoef(c,l,3);d2=detcoef(c,l,2);d1=detcoef(c,l,1);