micky_hkw 发表于 2006-5-13 20:25

[求助]菜鸟请教一个小问题

如何编一个50HZ正弦波的程序;式子s=sin(100×pi×t)

yangzj 发表于 2006-5-13 20:34

fs=1024;%采样频率<BR>N=1024;%采样点数<BR>dt=1/fs;%采样间隔<BR>t=(0:N-1)*dt;<BR>f=50;<BR>s=sin(2*pi*f*t);

micky_hkw 发表于 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();<BR>s2=1/3*sin(6*pi*f*t);<BR>subplot(3,1,2);plot(s2);<BR>axis();<BR>s3=1/5*sin(10*pi*f*t);<BR>subplot(3,1,3);plot(s3);<BR>axis();<BR>s=s1+s2+s3;<BR>figure(2);<BR>plot(s);xlabel('时间 t/s');ylabel('幅值 A');<BR>axis();<BR>=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();<BR>subplot(5,1,2);plot(a4,'LineWidth',1);ylabel('a4');<BR>axis();<BR>subplot(5,1,3);plot(a3,'LineWidth',1);ylabel('a3');<BR>axis();<BR>subplot(5,1,4);plot(a2,'LineWidth',1);ylabel('a2');<BR>axis();<BR>subplot(5,1,5);plot(a1,'LineWidth',1);ylabel('a1');<BR>axis();<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();<BR>subplot(5,1,2);plot(d4,'LineWidth',1);ylabel('d4');<BR>axis();<BR>subplot(5,1,3);plot(d3,'LineWidth',1);ylabel('d3');<BR>axis();<BR>subplot(5,1,4);plot(d2,'LineWidth',1);ylabel('d2');<BR>axis();<BR>subplot(5,1,5);plot(d1,'LineWidth',1);ylabel('d1');<BR>axis();<BR>xlabel('时间 t/s');

yangzj 发表于 2006-5-13 22:19

<P>Undefined function or variable "x".</P>
<P>Error in ==&gt; untitled at 19<BR>=wavedec(x,5,'db5');</P>

yangzj 发表于 2006-5-13 22:22

是s吧
页: [1]
查看完整版本: [求助]菜鸟请教一个小问题