这个程序出问题了..那位大侠帮忙修改一下
clear;m=sqrt(-1);
delta=0.101043;
a1=-0.850848;
sample=32; %number of sample spot
p=10; %number of sample spot in coef method;
f1=0.05; f2=0.40; f3=0.42;
fstep=0.01;
fstart=-0.5;
fend=0.5;
f=fstart:fstep:fend;
nfft=(fend-fstart)/fstep+1;
%un=urn+juin
urn= normrnd(0,delta/2,1,sample);
uin= normrnd(0,delta/2,1,sample);
un=urn+m*uin;
%计算 zn
for n=1:sample-1
zn(1)=un(1);
zn(n+1)=-a1*zn(n)+un(n+1);
end
%计算 xn
for n=1:sample
xn(n)=2*cos(2*pi*f1*(n-1))+2*cos(2*pi*f2*(n-1))+2*cos(2*pi*f3*(n-1))+sqrt(2)*real(zn(n));
end
%*********************************************************
x=xn';
for k=0:1:sample-1
s=0;
for n=1:sample-k,
s=s+conj(x(1,n))*x(1,n+k); %calculate the value of rxx
end
rxx(1,k+1)=(1/sample)*s;
end
Rx=zeros(sample,sample);
Rx=toeplitz(rxx(1,1:32));
=svd(Rx);
Pmusicf=zeros(1,1/fstep+1);
ei=zeros(1,sample);
for i=1:length(f)
for j=1:sample
ei(1,j)=exp(-2*pi*(j-1)*f(i)*m);
end;
sum=0;
for k=7:sample
sum=sum+abs(ei*V(:,k))^2;
end
Pmusicf(1,i)=10*log10(1/sum);
end
figure
plot(f,Pmusicf); 原帖由 chenhainiany 于 2007-5-23 16:27 发表 http://www.chinavib.com/forum/images/common/back.gif
clear;
m=sqrt(-1);
delta=0.101043;
a1=-0.850848;
sample=32; %number of sample spot
p=10; %number of sample spot in coef method;
f1=0.05; f2=0.40; f3=0.42;
fstep=0.01;
fs ...
请先看看置顶贴:聚宝盆
页:
[1]