运行不出正确的结果啊···各位高人帮帮忙吧
clear all
>>
>> D=randint(1,10)
N=length(D); %基带信号符号数目
t=0:0.01:9.99; %采样时间间隔
d0=D;
D0=[];
f=2;
l=ones(1,100);
for k0=1:N,
D0=[D0,d0(k0)*l];
end
figure(1);
subplot(821);
plot(t,D0);
axis([0,9.99,-1,2]); % 画出基带信号1
title('基带信号1');
M=length(D0);
for n=1:M;
if D0(n)>=1;
D1(n)=0;
else
D1(n)=1;
end
end
subplot(822); % 画出基带信号反码
plot(t,D1);
axis([0,9.99,-1,2]);
c1=sin(2*pi*f*t);subplot(823);
plot(c1);
title('载波信号1');
c2=sin(2*pi*f*t+pi);subplot(824);
plot(c2);
title('载波信号2'); %画出载波信号
xn1=c1.*D0;
subplot(825);
plot(t,xn1); %画出已调信号
title('已调信号1');
xn2=c2.*D1;
subplot(826);
plot(t,xn2); %画出已调信号
title('已调信号2');
e_PSK=xn1+xn2;subplot(827);
plot(t,e_PSK); %画出已调信号
title('PSK');
noise =rand(1,1000);
xn=e_PSK+noise;subplot(828);
plot(t,xn);
title('加入噪声的信号');
M=40;N=80;
>> n=1:128;
>> x(n)=xn;
>> X=zeros(N,M);
>> for(n=1:N);
for h=1:M;
X(n,h)=x(n+h-1);
end
end
>> Rxx=zeros(M,M);
>> for i=1:N;
y1=X(i,1:M);
Rxx=Rxx+1/N*(y1'*y1);
end
>> I=eye(M,M);
>> [U,E,V]=svd(Rxx);
>> for i=1:40;
if(E(i,i)/E(1,1)<0.04)
E(i,i)=0;
end
end
>> p=rank(E);
>> G=U(:,p+1:M);
>> S=U(:,1:p);
>> syms f Qw;
>> q(1:M)=exp(-j*(0:M-1)*2*pi*f);
>> f=0:0.001:0.5;
>> Qw=1/(q*(I-S*S')*q');
>> Qw=10*log(Qw);
>> plot(f,subs(Qw));
Warning: Imaginary parts of complex X and/or Y arguments
ignored
>> grid on