+ Post New Thread
Results 1 to 5 of 5

3rd September 2007, 12:17 #1
 Join Date
 Sep 2007
 Posts
 10
 Helped
 1 / 1
 Points
 986
 Level
 7
rayleighchan.m
dear friends..
did anybody used the function by name : rayleighchan in matlab..
actually when i use this function for simulating my ofdm system by making dopler frequency = 0 ..is working well..but when i make dopler frequncy Fd is varying the code is not giving any performance variations..
could u pls suggest me whether i have to use this 'rayleighchan' function inside the for loop or outside for loop..pls help me..
thanx regards..
uday

3rd September 2007, 12:17

5th September 2007, 20:13 #2
 Join Date
 May 2007
 Location
 LisboaPortugal
 Posts
 36
 Helped
 15 / 15
 Points
 2,084
 Level
 10
rayleighchan and sample time and sampling
Originally Posted by vuday455
I already used that function.
I'll assume you already type "help rayleighchan" in MatLab command window :D
You should use the "rayleighchan" function inside a 'for' loop where that has your variable "doppler frequency" as expression/statement.
I mean something like this...
% Generate data and do modulation
M =2; % BPSK modulation order
tx = randint(5000,1,M); % Random bit stream
pskSig = pskmod(tx,M); % PSK signal
ts = 1/100; %sample time
for fd = 0 : 10 %doppler shift
% Create Rayleigh fading channel object.
chan = rayleighchan(ts,fd);
% Apply fading channel.
fadedSig = filter(chan,pskSig); % Effect of channel
(... rest of the code that will work with the faded signal...)
end
If you want new data to be generated for every new doppler frequency, you should include it in the "for" too. In this simple example, I'm just changing the channel.
I hope this was what your asking for.
Cheers,
mar_deepmode

5th September 2007, 20:13

6th September 2007, 07:48 #3
 Join Date
 Sep 2007
 Posts
 10
 Helped
 1 / 1
 Points
 986
 Level
 7
matlab doppler frequency
hi could u pls check this code and give solution since it is giving same performance with and without equaliser...
thanx regards..
uday
<**********************>
% ofdm system design ...
% BW = input('enter the channel bandwidth :');
% Nused = input('enter the number of subcarriers :');
% n_factor = input('enter the sampling factor :');
% G = input('enter the ration of CP time to Useful time :');
clear all
close all
clc
BW = 1.75e6;
Nused = 200;
n_factor = 8/7;
G = 1/4;
[Nfft,Fs,delta_f,Tb,Tg,Ts,sampling_time] = derived_parameters(BW,Nused,n_factor,G);
% Nfft>fft size , Fs>sampling frequency , delta_f>suhcarrier spacing
% Tb> useful symbol time, Tg>guard/CP time, Ts>OFDM Symbol
% time (Tb+Tg)
N_prefix = Nfft*G;
N_data = 192;
N_pilot = 8;
SNR = 0:2:20; % snr in db
M = 4; % order of modulation
n = log2(M); % no. of bits per symbol
% chan = rayleighchan(sampling_time,200);
% chan.resetbeforefiltering = 0;
ber_final = zeros(1,length(SNR));
no_of_symbols = 100;
%chan.resetbeforefiltering =0;
for i = 1:length(SNR)
i
test_1 = [];
test_2 = [];
errors_new = 0;
for j=1:no_of_symbols
x_user = floor(M*rand(N_data,1));
test_1 = [test_1,x_user.'];
%x_user = floor(M*rand(Nfft,1));
X_mod_out = qammod(x_user,M).';
% subcarrier_out = subcarrier_mapping(X_mod_out.',Nfft);
% subcarrier mapping
subcarrier_out = zeros(Nfft,1);
subcarrier_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,1 68:191,193:216,218:229]) = X_mod_out;
% % processing information for getting timedomain waveform
% subcarrier_out = X_mod_out;
x_out = tx_sub_part(subcarrier_out,Nfft);
x_ofdm_symbol = [x_out(NfftN_prefix+1:end),x_out].';
% channel generation and passing the signal through fading channel
%chan = rayleighchan(sampling_time,2,[0,1.5e5,3.2e5],[0,3,3]);
%chan.StoreHistory = 0;
chan = rayleighchan(sampling_time,100);
%chan = rayleighchan(sampling_time,10,[0,Tg/4],[0,20]);
% chan.resetbeforefiltering = 0;
%chan = ricianchan(sampling_time,4,[0,Tg/10],[0,9],10);
y_fading = filter(chan,x_ofdm_symbol);
gain_c = chan.pathgains;
Gain_c = fft(gain_c,Nfft).';
% pasing signal through awgn channel
y_awgn = awgn(y_fading,SNR(i),'measured');
% removing the cycling prefix part
% it is also known as synchronisation part
% here perfect synchronisation is assued
y_received = y_awgn(N_prefix+1:end);
% one tap equalizer is implimented below
r_out = rx_sub_part(y_received.',Nfft);
eq_out = r_out./Gain_c;
%demap_out = subcarrier_demap(r_out);
% getting information symbols by subcarrier demapping
demap_out = eq_out([29:40,42:65,67:90,92:115,117:128,130:141,143:166,1 68:191,193:216,218:229]);
%demap_out = r_out;
% demodulation of the signal
x_cap = qamdemod(demap_out,M);
test_2 = [test_2,x_cap.'];
%[ no_of_errors,BER ] = biterr(x_cap,x_user);
%errors_new = errors_new + no_of_errors;
end
[ no_of_errors,BER(i) ] = biterr(test_1,test_2);
%ber_final(i) = errors_new/(N_data*no_of_symbols);
end
semilogy(SNR,BER);
xlabel('SNR in dB');
ylabel('BER Values');
title('SNR Vs BER plot');
% this programme is for subpart of the transmitter...
% input> Xin : out put of modulator
% Nfft : FFT size
% output> x_out : time domain version ( 1xNfft )
function [x_out] = tx_sub_part(Xin,Nfft)
[x_out] = ifft(Xin.',Nfft);
end
% this function is for implimenting the subpart of the receiver
% input> r_in : output of the channel
% Nfft : FFT size
% output> R_out : frequency domain version of the received signal
% (1xNfft)
function [R_out] = rx_sub_part(r_in,Nfft)
[R_out] = fft(r_in.',Nfft);
end
<********************>
thanx regards..
uday

6th September 2007, 07:48

6th September 2007, 12:23 #4
 Join Date
 May 2007
 Location
 LisboaPortugal
 Posts
 36
 Helped
 15 / 15
 Points
 2,084
 Level
 10
rayleighchan filter matlab
Originally Posted by vuday455
I don't know if you can provide it, but is it asking too much for you to send me your code files that you're running in MatLab by P.M.?
Because I can't run it in MatLab.. I don't have function "derived_parameters" and I'm don't have much free time now to copy/paste it in ".m" files..
And I see too many
chan = rayleighchan(...);
in your code.. but I think this one what you're using right?
chan = rayleighchan(sampling_time,100);
If it is this one, then your channel is always the same, because you aren't changing doppler frequency! Doppler frequency is tied to value 100!
CHAN = RAYLEIGHCHAN(TS, FD) constructs a frequencyflat ("single path")
Rayleigh fading channel object. TS is the sample time of the input
signal, in seconds. FD is the maximum Doppler shift, in Hertz.
You must include your channel in a "for" cycle where you change doppler frequency!
And everything below the creation of your channel must be included on it!
Regards,
mar_deepmode

7th September 2007, 10:05 #5
 Join Date
 Nov 2005
 Posts
 57
 Helped
 2 / 2
 Points
 2,111
 Level
 10
dopler
Doppler has a devastating effect on OFDM signal due to ICI and loss of synchronizarion ,unless adequate compenasation techniques are applied
+ Post New Thread
Please login