need help for correcting the program -(MIMO-OFDM)

Status
Not open for further replies.

MATHU

Newbie level 5
Joined
Oct 3, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,368
Please anyone help me for correcting the program given below. its very urgent......thanks in advance.

clear;
ch_no=6;
fc=2e9; fs_Hz=1e7;
M=1024;
N=10000;
Nfosf=4;
[Delay_us, Power_dB, K_factor, Doppler_shift_Hz, Ant_corr, Fnorm_dB] =SUI_parameters(ch_no);
[FadMtx,tf]=SUI_fading(Power_dB,K_factor,Doppler_shift_Hz, Fnorm_dB, N, M, Nfosf);
c_table=[b,r,m,k];
subplot(311)
stem(Delay_us,10.^(Power_dB/10)), axis([-1 21 0 1.1])
grid on, xlabel('Delay time[ms]'), ylabel('Channel gain');
title(['PDP of Channel No.',num2str(ch_no)]);
subplot(312);
for k=1:length(Power_dB)
plot((0:length(FadMtx(k,)-1)*tf,20*log10(abs(FadMtx(k,)), c_table(k));
hold on
end
grid on, xlabel('Time'), ylabel('Channel Power[dB]');
title(['Channel No.','num2str(ch_no)']);
axis([0 60 -50 10]);
legend('Path 1','Path 2','Path 3');
idx_nonz=find(Doppler_shift_Hz);
FadFreq =ones(length(Doppler_shift_Hz),M);
for k=1:length(idx_nonz)
max_dsp=2*Nfosf*max(Doppler_shift_Hz);
dfmax=max_dsp/M;
% Doppler frequency spacing respect to maximal Doppler frequency
Nd=floor(Doppler_shift_Hz(k)/dfmax)-1;
f0 = -Nd+1:Nd/(Nd);
f=f0.*Doppler_shift_Hz(k);
tmp=0.785*f0.^4 - 1.72*f0.^2 + 1.0; % Eq.(2.41)
hpsd=psd(spectrum.welch,FadMtx(idx_nonz(k),,'Fs',max_dsp,...
'SpectrumType','twosided');
nrom_f=(hpsd.Frequencies)-mean(hpsd.Frequencies);
PSD_d=fftshift(hpsd.Data);
subplot(3,3,6+k), plot(nrom_f,PSD_d,'b','f','tmp','r');
xlabel('Frequency[Hz]'), % axis([-1 1 0 1.1*max([PSD_d tmp])])
title(['h_',num2str(idx_nonz(k)),' path']);
end

***************************************
function [FadMtx,tf]=SUI_fading(Power_dB,K_factor,Doppler_shift_Hz, Fnorm_dB, N, M, Nfosf)
% SUI fading generation using FWGN with fitering in frequency domain
% FadingMatrixTime=SUI_fading(Power_dB, K_factor,...
% Doppler_shift_Hz, Fnorm_dB, N, M, Nfosf)
% Inputs:
% Power_dB : power in each tap in dB
% K_factor : Rician K-factor in linear scale
% Doppler_shift_Hz : a vector containing maximum Doppler
% frequency of each path in Hz
% Fnorm_dB : gain normalization factor in dB
% N : # of independent random realizations
% M : length of Doppler filter, i.e, size of IFFT
% Nfosf : fading oversampling factor
% Outputs:
% FadMtx : length(Power_dB) x N fading matrix
% tf : fading sample time=1/(Max. Doppler BW * Nfosf)
Power = 10.^(Power_dB/10);
s2 = Power./(K_factor+1);
s=sqrt(s2);
m2 = Power.*(K_factor./(K_factor+1));
m = sqrt(m2); % calculate constant part
L=length(Power);
fmax= max(Doppler_shift_Hz);
tf=1/(2*fmax*Nfosf);
if isscalar(Doppler_shift_Hz)
Doppler_shift_Hz= Doppler_shift_Hz*ones(1,L);
end
path_wgn= sqrt(1/2)*complex(randn(L,N),randn(L,N));
for p=1:L
filt=gen_filter(Doppler_shift_Hz(p),fmax,M,Nfosf);
path(p,=fftfilt(filt,[path_wgn(p, zeros(1,M)]); % filtering WGN
end
FadMtx= path,M/2+1:end-M/2);
for i=1:L , FadMtx(i,=FadMtx(i,*s(i)+m(i)*ones(1,N);
end
FadMtx = FadMtx*10^(Fnorm_dB/20);

***************************************

function [Delay_us,Power_dB,K,Doppler_shift_Hz,Ant_corr,Fnorm_dB]=SUI_parameters(ch_no)

% Inputs:
% ch_no : channel scenario number
% Ouptuts:
% Delay_us : tap delay[us]
% Power_dB : power in each tap[dB]
% K : Ricean K-factor in linear scale
% Doppler_shift_Hz: Doppler frequency [Hz]
% Ant_corr : antenna (envelope) correlation coefficient
% Fnorm_dB : gain normalization factor[dB]
if ch_no<1 || ch_no>6, error('No such a channnel number');
end
Delays= [0 0.4 0.9; 0 0.4 1.1; 0 0.4 0.9; 0 1.5 4; 0 4 10; 0 14 20];
Powers= [0 -15 -20;0 -12 -15;0 -5 -10;0 -4 -8;0 -5 -10;0 -10 -14];
Ks = [4 0 0; 2 0 0; 1 0 0; 0 0 0; 0 0 0; 0 0 0];
Dopplers = [0.4 0.3 0.5; 0.2 0.15 0.25; 0.4 0.3 0.5;0.2 0.15 0.25; 2 1.5 2.5; 0.4 0.3 0.5];
Ant_corrs = [0.7 0.5 0.4 0.3 0.5 0.3];
Fnorms = [-0.1771 -0.393 -1.5113 -1.9218 -1.5113 -0.5683];
Delay_us= Delays(ch_no,;
Power_dB= Powers(ch_no,;
K=Ks(ch_no,;
Doppler_shift_Hz= Dopplers(ch_no,;
Ant_corr= Ant_corrs(ch_no);
Fnorm_dB= Fnorms(ch_no);
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…