flat_channel.m

来自「在MIMO系统中」· M 代码 · 共 30 行

M
30
字号
function [channel_output,H] = flat_channel(Rx_n, channel_input)
% Tx_n : the Tx antenna number 
% Rx_n : the Rx antenna number
% channel_input :the size is [Tx_n , frame_length]
% channel_output:the size is[Rx_n,frame_length )
%channel:slow flat fading--rayleigh distribute
%------------------------------------------------------------
%for debug
%Rx_n = 2;
%channel_input = ones(3,10);
%channel_input(2,:) = 2;
%channel_input(3,:) = 3;
%------------------------------------------------------------
%rayleigh
% channel for transmit antenna--->receive antenna 
[Tx_n,frame_length] = size(channel_input);
for rx = 1:Rx_n
	for tx = 1:Tx_n
		randn('state',sum(100*clock));%reset randn
		x = randn(1); 
		y = randn(1);
		alpha = sqrt(x^2+y^2);    %rayleigh distributed
		theta = 2*pi*rand(1);   %united distributed
		H(rx,tx) = alpha*exp(j*theta);
	end
end
channel_output = zeros(Rx_n,frame_length);
channel_output = H*channel_input;
%the end
%the awgn noise add in main program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?