www.pudn.com > ldpc802.16.rar > vector_fading_doppler_channel.m, change:2005-11-14,size:1994b


function [data_out]=vector_fading_doppler_channel(data_in,model_index,model_type,VectChan,fd,oversampling_rate_in,oversampling_rate_out,current_loop) 
%This functoin let the data pass a Rayleigh fading channel  
 
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_fading=zeros(6,1); ch_fading(1)=1; 
 
 
ch_tao=round(ch.tap_prof(:,1).'*1e6*oversampling_rate_in); 
for i=1:size(ch.tap_prof,1); 
    %add spatial channel characteristic 
    cent_angle=(rand-0.5)*VectChan.BtsAngleSpread; 
    A(:,i)=GenDoa(VectChan.M,cent_angle,VectChan.ArrayGeometry,VectChan.AntSpace); 
    status=fseek(fid1,(i-1)*4*gap+4*(current_loop-1)*ch_length,-1); 
    %status=fseek(fid1,(i-1)*4*gap+4*(current_loop-1)*1e3,-1); 
    if status~=0 
        error('Error in read file.'); 
    end; 
    status=fseek(fid2,(i-1)*4*gap+4*(current_loop-1)*ch_length,-1); 
    %status=fseek(fid2,(i-1)*4*gap+4*(current_loop-1)*1e3,-1); 
    if status~=0, 
        error('Error in read file.'); 
    end; 
    for m=1:VectChan.M, 
        ch_tap{m}(i,:)=A(m,i)*ch_fading(i)*complex(fread(fid1,ch_length,'float32'),fread(fid2,ch_length,'float32')); 
    end; 
end 
fclose(fid1); 
fclose(fid2); 
switch fd 
    case '5Hz' 
        power_h=sum(power(abs(ch_tap(:,floor(size(ch_tap,2)/2))),2)); 
        ch_tap=ch_tap/sqrt(power_h); 
end; 
for m=1:VectChan.M, 
    [h{m}]=up_sampling(ch_tap{m},oversampling_rate_in*10); 
    [data_fading{m}]=pass_fading_channel(data_in,ch_tao,h{m}(:,1:length(data_in))); 
    [data_out{m}]=down_sampling(data_fading{m},oversampling_rate_in/oversampling_rate_out); 
end;