adaptive.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:1k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function C=adaptive(H,N,R)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 功能: 自适应的比特分配:按照信道响应降序排列,子载波间争夺比特和功率
- % 步长为2
- % 输入: H为信道的参数
- % N为子载波数
- % 输出: C,得到的比特分配
- % 作者:郭莹,2004.3
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- dex=zeros(N,1);
- x=zeros(N,1);
- H=abs(H);
- for a=1:N
- x(a)=sum((H>H(a)))+1;
- for t=1:20
- if dex(x(a))~=0
- x(a)=x(a)+1;
- else break
- end
- end
- dex(x(a))=a;
- end
- C=R/N*ones(N,1);
- for m=1:N-1
- for n=N:-1:m+1
- if C(dex(m))>3
- break
- end
- if C(dex(n))==0
- continue
- end
- a=H(dex(m))^2;
- b=H(dex(n))^2;
- switch (C(dex(n)))
- case 1
- if a>2*b
- C(dex(m))=C(dex(m))+1;
- C(dex(n))=C(dex(n))-1;
- end
- case 2
- if a>3*b
- C(dex(m))=C(dex(m))+1;
- C(dex(n))=C(dex(n))-1;
- end
- end
- end
- end