原帖由 ChaChing 于 2009-3-22 22:31 发表
没头没尾, 叫人怎猜测, 算命吗?!:lol
至少让别人知道LZ输入那些命令, 猜测会不会LZ有循环未结束?!
还有个人水平有限, 建议楼主加强发问题方式!
syms t n k x y f
Nn=32;
T=2*pi;
tao=pi;
Nf=30;an=zeros(Nf+1,1);
an=zeros(Nf+1,1);
bn=zeros(Nf+1,1);
phase=zeros(Nf+1,1);
s1=strcat('heaviside(t+',num2str(tao/2),')');
s2=strcat('heaviside(t-',num2str(tao/2),')');
x=sym(s1)-sym(s2);
s3=cos(t);
y=sym(cos(t));
f=x.*y;
ezplot(t,f);
A0=2*int(f,t,-pi,pi)/pi;
AS=int(f,t,-pi,pi)/pi;
BS=int(f,t,-pi,pi)/pi;
an(1)=double(vpa(A0,Nn));
for k=1:Nf
an(k+1)=double(vpa(subs(AS,n,k),Nn));
bn(k+1)=double(vpa(subs(BS,n,k),Nn));
end
cn=sqrt(an.*an+bn.*bn);
for i=1:Nf;
if an(i)>=0
phase(i)=0;
else
phase(i)=pi;
end
end
>> syms d
>> t=-T*5:0.001:T*5;
>> d=-T*5:T:T*5;
>> xx=pulstran(t,d,'rectpuls',tao);
>> xxx=sym(xx);
>> ff=xxx.*y;
我才写到这就运行不动了,不知道是怎么回事?by the way ,多谢你的提醒,我看了原来的贴,确实让人看了不知道问什么。呵呵 |