decode1.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:1k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function output=decode1(Y,H,Cons,hard_soft)
- %% hard_soft : 1: hard , 0; soft
- con_len = length(Cons);
- G=inv(H'*H)*H';%求H的伪逆矩阵
- ch=H;
- len=size(H);
- S=zeros(1,len(2));
- for i=1:1:len(2)
- len1=size(G,1);
- for l=1:1:len1
- m(l)=norm(G(l,:));%计算H的伪逆矩阵的每一行的范数
- end
- n=find(m==min(m));%找出最小范数所对应的行
- m=zeros(1,len(2)-i);
- know=1;
- kpre=n;
- while(kpre>=know)
- if S(1,know)~=0
- kpre=kpre+1;
- end
- know=know+1;
- end
- S(kpre)=kpre;
- w=G(n,:);%取出范数最小的行
- y=w*Y;%求出估计值
- if hard_soft == 0
- output(kpre,:)=y;
- M = zeros(1,con_len);
- for k=1:1:con_len %对估计值进行判决
- M(k)=(y-Cons(k))*conj(y-Cons(k));
- end
- output1(kpre,:)=Cons(find(M==min(M)));
- Y=Y-output1(kpre,:)*H(:,kpre);%消除信号的干扰
- h=zeros(len(1),len(2)-i);
- h=ch(:,[1:n-1,n+1:len(2)-i+1]);%去掉范数最小的行对应的信道矩阵中的列
- ch=h;
- G=inv(ch'*ch)*ch'; %求伪逆矩阵
- else
- M = zeros(1,con_len);
- for k=1:1:con_len %对估计值进行判决
- M(k)=(y-Cons(k))*conj(y-Cons(k));
- end
- output(kpre,:)=Cons(find(M==min(M)));
- Y=Y-output(kpre,:)*H(:,kpre);%消除信号的干扰
- h=zeros(len(1),len(2)-i);
- h=ch(:,[1:n-1,n+1:len(2)-i+1]);%去掉范数最小的行对应的信道矩阵中的列
- ch=h;
- G=inv(ch'*ch)*ch'; %求伪逆矩阵
- end
- end