??? Error: File: C:\MATLAB7\work\Untitled.m Line: 2 Column: 1 Missing variable or function.
M=4;
k=log2(M);
n=7000;
%u=0.05;
u=0.001;
m=400;
%h=[0.05 -0.063 0.088];%-0.126]; -0.25];
h=[1 0.3 -0.3 0.1 -0.1];
L=7;
mse_av=zeros(1,n-L+1);
for j=1:m
a=randint(1,n,M);
a1=qammod(a,M);
m1=abs(a1).^4;
m2=abs(a1).^2;
r1=mean(m1);
r2=mean(m2);
R2=r1/r2;
% R2=sqrt(2);
s=filter(h,1,a1);
snr=15;
x=awgn(s,snr,'measured');
c=[0 0 0 1 0 0 0];
for i=1:n-L+1
y=x(i+L-1:-1:i);
z(i)=c*y';
e=R2-(abs(z(i))^2);
%u=0.0005*(1-(1/sqrt(2*pi)*(exp(50*(-e^2/2)))));
%u=0.0005*(1-(exp(-50*e^2)));
%u=e*(1-exp(-5*e^2));
c=c+u*e*y*z(i);
mse(i)=e^2;
end;
mse_av=mse_av+mse;
end;
mse_av=mse_av/m;
hold on
plot([1:n-L+1],mse_av,'r')
hold on
scatterplot(a1,1,0,'r*');
hold on
scatterplot(x,1,0,'g*');
hold on
scatterplot(z(1000:6800),1,0,'r*');
hold off 展开
不知道啊。运行MATLAB没出图,就显示上面的错误了??? Error: File: C:\MATLAB7\work\Untitled.m Line: 2 Column: 1
Missing variable or function.
我运行一切正常,只是m改小了点,运算时间减少了,可能你没有安装工具箱---就是没有它需要的函数。
M=4; k=log2(M); n=7000; u=0.001; m=20;
h=[1 0.3 -0.3 0.1 -0.1]; L=7; mse_av=zeros(1,n-L+1);
for j=1:m
a=randint(1,n,M); a1=qammod(a,M); m1=abs(a1).^4; m2=abs(a1).^2; r1=mean(m1); r2=mean(m2); R2=r1/r2;
s=filter(h,1,a1); snr=15; x=awgn(s,snr,'measured'); c=[0 0 0 1 0 0 0];
for i=1:n-L+1
y=x(i+L-1:-1:i); z(i)=c*y'; e=R2-(abs(z(i))^2);
c=c+u*e*y*z(i); mse(i)=e^2;
end;
mse_av=mse_av+mse;
end;
mse_av=mse_av/m;
hold on
plot([1:n-L+1],mse_av,'r')
hold on
scatterplot(a1,1,0,'r*');hold on
scatterplot(x,1,0,'g*');
hold on
scatterplot(z(1000:6800),1,0,'r*');hold off