网站最新上线:http://www.hslogic.com/

matlab频谱代码

上一篇 / 下一篇  2018-02-07 20:03:17

M=256;
for i=1:M
x(i)=cos(0.25*pi*i);
n(i)=i;
end;
subplot(2,2,1);
plot(n,x);
N=M;
for j=1:N
XR(j)=0;XI(j)=0;
for i=1:M
XR(j)=XR(j)+x(i)*cos((2*pi/N)*(j-1)*(i-1));
XI(j)=XI(j)+x(i)*sin((2*pi/N)*(j-1)*(i-1));
end
XM(j)=sqrt(XR(j)*XR(j)+XI(j)*XI(j));
m(j)=2*j/N;
end
subplot(2,2,2);
plot(m,XM);

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar
博评网