www.pudn.com > ldpc802.16.rar > fading_doppler_channel.m, change:2005-11-21,size:1857b


function [data_out]=fading_doppler_channel(data_in,model_index,model_type,fd,oversampling_rate_in,oversampling_rate_out,current_loop) 
%This functoin let the data pass a Rayleigh fading channel 
%data_in---oversampled tansmited signal 
%model_index------'itu' or 'sui' 
%model_type -------channel model type, such as '3A' 
%fd----maximum doppler frequency offset, currently surpport '300Hz','200Hz','100Hz','50Hz','20Hz' 
%oversampling_rate_in---oversampling rate before channel 
%oversampling_rate_out---oversampling rate after channel 
%current_loop-----current frame No. From 1:Max_loop  
 
len=length(data_in); 
data_out=zeros(1,len*oversampling_rate_out/oversampling_rate_in); 
 
ch=ch_profile(model_index,model_type); 
filename1=['E:\MATLAB704\work\ChannelModel\Rayleigh_' fd '_real.r32']; 
filename2=['E:\MATLAB704\work\ChannelModel\Rayleigh_' fd '_imag.r32']; 
fid1=fopen(filename1,'rb'); 
fid2=fopen(filename2,'rb'); 
if (fid1==-1)||(fid2==-1) 
    error('Open file failure.'); 
end 
gap=100000; 
ch_length=floor(length(data_in)/oversampling_rate_in/10)+1; 
ch_fading=power(10,ch.tap_prof(:,2)/20)/sqrt(sum(power(10,ch.tap_prof(:,2)/10))); 
ch_tao=round(ch.tap_prof(:,1).'*1e6*oversampling_rate_in); 
for i=1:size(ch.tap_prof,1); 
    status=fseek(fid1,(i-1)*4*gap+4*(current_loop-1)*ch_length,-1); 
    if status~=0 
        error('Error in read file.'); 
    end; 
    status=fseek(fid2,(i-1)*4*gap+4*(current_loop-1)*ch_length,-1); 
    if status~=0 
        error('Error in read file.'); 
    end; 
    ch_tap(i,:)=ch_fading(i)*complex(fread(fid1,ch_length,'float32'),fread(fid2,ch_length,'float32')); 
end 
fclose(fid1); 
fclose(fid2); 
[h]=up_sampling(ch_tap,oversampling_rate_in*10); 
[data_fading]=pass_fading_channel(data_in,ch_tao,h(:,1:length(data_in))); 
[data_out]=down_sampling(data_fading,oversampling_rate_in/oversampling_rate_out);