声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 790|回复: 4

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

[复制链接]
发表于 2006-5-13 20:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
如何编一个50HZ正弦波的程序;式子s=sin(100×pi×t)
回复
分享到:

使用道具 举报

发表于 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);
 楼主| 发表于 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');
发表于 2006-5-13 22:19 | 显示全部楼层
<P>Undefined function or variable "x".</P>
<P>Error in ==&gt; untitled at 19<BR>[c,l]=wavedec(x,5,'db5');</P>
发表于 2006-5-13 22:22 | 显示全部楼层
是s吧
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-24 21:22 , Processed in 0.051587 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表