st_decoding.m
资源名称:MIMO-OFDM.rar [点击查看]
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:3k
源码类别:
传真(Fax)编程
开发平台:
Matlab
- function st_decoded = st_decoding( Recv,channel_est ,N_subc,N_data_sym, N_Tx_ant, N_Rx_ant ,ST_Code, ...
- Idx_data,RateSTCoding,Modulation,hard_soft,LST_method,var_noise,ChannelEffectTest)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % 空时解码和分集处理
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- st_decoded = zeros(N_subc,N_data_sym*RateSTCoding);
- if ChannelEffectTest ~= 2
- % 如果没有发送分集(无空时编码)
- if N_Tx_ant == 1
- %H = squeeze(channel_est(:,1,:));
- % 1发多收最大比合并,如果是1收则此程序简化为单天线信道特性补偿
- st_decoded = MRC_combine(Recv,channel_est,Idx_data,N_data_sym,N_Rx_ant,N_subc);
- % 如果有发送分集
- else
- % 如果使用空时分组码
- if ST_Code == 1
- % 先对每条接收天线进行多发1收解码
- for n_r = 1:N_Rx_ant
- % 计算本帧的所有数据OFDM符号,需要分为多少组,送入STBC解码器
- loop_num = N_data_sym * RateSTCoding/N_Tx_ant ;
- for n = 1:loop_num
- % 取出一组OFDM符号,为一次性送入空时解码器的符号组
- R = Recv(:,(n-1)*N_Tx_ant/RateSTCoding + 1:n*N_Tx_ant/RateSTCoding,n_r);
- % 取出对应的信道估计,对一条接收天线而言,需要发送天线数N_Tx_ant个信道响应
- H = channel_est(:,(n-1)*N_Tx_ant/RateSTCoding + 1:n*N_Tx_ant/RateSTCoding,...
- (n_r-1)*N_Tx_ant + 1:n_r*N_Tx_ant);
- % 把一组OFDM符号和对应的信道响应,送入STBC解码器
- decoded(:,(n-1)*N_Tx_ant + 1:n*N_Tx_ant,n_r) = stbc_decode(R,H,Idx_data,N_Tx_ant,N_subc);
- end
- % 再进行1发多收的合并.因为在stbc_decode中已经补偿了信道,所以此处为等增益合并
- st_decoded = st_decoded + decoded(:,:,n_r);
- end
- st_decoded = st_decoded / N_Rx_ant;
- % 如果使用分层空时码
- elseif ST_Code == 2
- if Modulation == 2
- Cons = exp(j*[-3/4*pi 3/4*pi -1/4*pi 1/4*pi])/sqrt(N_Tx_ant); % QPSK 调制映射关系
- elseif Modulation == 1
- Cons = [1 -1]/sqrt(N_Tx_ant); % BPSK 调制映射关系
- end
- for n = 1:N_data_sym
- % 取出一个OFDM符号以及其对应的(N_Tx_ant×N_Rx_ant)个信道响应
- Y = Recv(Idx_data,n,:);
- H = channel_est(Idx_data,n,:);
- % 送入BLAST空时解码器
- st_decoded(Idx_data,(n-1)*N_Tx_ant + 1:n*N_Tx_ant) = BLAST_decode(Y,H,Cons,hard_soft,LST_method,var_noise);
- end
- end
- end
- elseif ChannelEffectTest == 2
- st_decoded = Recv;
- end