1个回答
展开全部
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);
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);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询