|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
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));
[U,S,V]=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); |
|