|
楼主 |
发表于 2006-5-13 21:45
|
显示全部楼层
回复:(micky_hkw)[求助]菜鸟请教一个小问题
请假:为什么这个程序的高低频分解图形没有了?<BR>fs=1024;%采样频率<BR>N=1024;%采样点数<BR>dt=1/fs;%采样间隔<BR>t=(0:N-1)*dt;<BR>f=50;<BR>s1=sin(2*pi*f*t);<BR>subplot(3,1,1);plot(s1);<BR>axis([0 100 -1 1]);<BR>s2=1/3*sin(6*pi*f*t);<BR>subplot(3,1,2);plot(s2);<BR>axis([0 100 -1 1]);<BR>s3=1/5*sin(10*pi*f*t);<BR>subplot(3,1,3);plot(s3);<BR>axis([0 100 -1 1]);<BR>s=s1+s2+s3;<BR>figure(2);<BR>plot(s);xlabel('时间 t/s');ylabel('幅值 A');<BR>axis([0 100 -1 1]);<BR>[c,l]=wavedec(x,5,'db5');<BR>a5=wrcoef('a',c,l,'db5',5);<BR>a4=wrcoef('a',c,l,'db5',4);<BR>a3=wrcoef('a',c,l,'db5',3);<BR>a2=wrcoef('a',c,l,'db5',2);<BR>a1=wrcoef('a',c,l,'db5',1);<BR>figure(3)<BR>subplot(5,1,1);plot(a5,'LineWidth',1);ylabel('a5');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,2);plot(a4,'LineWidth',1);ylabel('a4');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,3);plot(a3,'LineWidth',1);ylabel('a3');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,4);plot(a2,'LineWidth',1);ylabel('a2');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,5);plot(a1,'LineWidth',1);ylabel('a1');<BR>axis([0 500 -1 1]);<BR>xlabel('时间 t/s');<BR>d5=wrcoef('d',c,l,'db5',5);<BR>d4=wrcoef('d',c,l,'db5',4);<BR>d3=wrcoef('d',c,l,'db5',3);<BR>d2=wrcoef('d',c,l,'db5',2);<BR>d1=wrcoef('d',c,l,'db5',1);<BR>figure(4)<BR>subplot(5,1,1);plot(d5,'LineWidth',1);ylabel('d5');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,2);plot(d4,'LineWidth',1);ylabel('d4');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,3);plot(d3,'LineWidth',1);ylabel('d3');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,4);plot(d2,'LineWidth',1);ylabel('d2');<BR>axis([0 500 -1 1]);<BR>subplot(5,1,5);plot(d1,'LineWidth',1);ylabel('d1');<BR>axis([0 500 -1 1]);<BR>xlabel('时间 t/s'); |
|