| Author |
Message |
yesh_r1
Joined: 15 May 2007 Posts: 17
|
15 May 2007 18:30 OFDM MAtlab Simulation - Doubt ( My code is in the message ) |
|
|
|
|
Hello friends...
I am new to OFDM technology. I am trying to simulate it in Matlab 7.0, with BPSK configuration.
NOTE :
1. I have assumed the frequencies to be integral multiples of 1. So the frequencies used would be 1, 2, 3, 4 ... N;
N - Number of sub carriers
Nb - Represents the total number of bits being transmitted
c - reshaped array (Nb bits were reshaped into this array)
2. Not assuming any channel conditions. I am just converting the signal into ofdm and trying to reconvert it back to serial data. I have applied FFT for the OFDM signal and I am able to see the data, but how do i convert it back to parrellel form ?
3. I think i have gone wrong some where conceptually. I am unable to find out where.. :( I request your help ...
5. This is my code :
******** program begins **********************
clc;
clear all;
N = 4;
Nb = 16;
symrate = 1;
sampfreq = 1;
%inp = [1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0];
inp = randint(1,Nb);
c = (reshape(inp,N,Nb/N))';
[x y] = size(c);
temp2 = zeros(1,(N+.5)*10);
temp3 = [];temp4 = [];
for i=1:x
for j=1:y
if (c(i,j)==1)
temp2((j*10)-1:(j*10)+1) = 1;
else
temp2((j*10)-1:(j*10)+1) = -1;
end
% figure;
% stem(temp2);
end
temp3 = [temp3 ; temp2];
temp4 = [temp4 ; c(i,:)];
end
[x y] = size(temp3);
[x1 y1] = size(temp4);
invfft = [];
invfft1 = [];
realinvfft = [] ;
absinvfft = [];
ofdm = zeros(1,y) ;
ofdm1 = zeros(1,y);
ofdm2 = zeros(1,N);
ofdm3 = zeros(1,N);
for i=1:x
invfft(i,:) = ifft(temp3(i,:));
end
for i=1:x1
invfft1(i,:) = ifft(temp4(i,:));
end
realinvfft = real(invfft1);
absinvfft = abs(invfft1);
for i=1:x1
temp5 = realinvfft(i,:);
%ofdm = ofdm + temp5;
ofdm2 = ofdm2 + temp5;
temp5 = absinvfft(i,:);
%ofdm1 = ofdm1 + temp5;
ofdm3 = ofdm3 + temp5;
end
f = 0:.1:(N+.9);
%plot(f,ofdm);
%figure;
plot(ofdm2);
title('OFDM Signal generated');
parrdata = fft(ofdm2);
figure;
stem(parrdata);
title('Parrellel Data');
figure;
stem(inp);
title('Input data');
********** End of program ************
|
|
| Back to top |
|
 |
Google AdSense

|
15 May 2007 18:30 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
eehero
Joined: 23 Nov 2005 Posts: 232 Helped: 9 Location: Libya
|
16 May 2007 13:47 OFDM MAtlab Simulation - Doubt ( My code is in the message ) |
|
|
|
|
| i am also new to OFDM technology can u advice me friend
|
|
| Back to top |
|
 |
Naveed Alam
Joined: 06 Jan 2006 Posts: 292 Helped: 16
|
24 May 2007 13:08 Re: OFDM MAtlab Simulation - Doubt ( My code is in the messa |
|
|
|
|
serial data can be converted back with 'reshape' function...
u have already used it, it must not be a problem for u...
Naveed
|
|
| Back to top |
|
 |
yesh_r1
Joined: 15 May 2007 Posts: 17
|
03 Jun 2007 20:14 Re: OFDM MAtlab Simulation - Doubt ( My code is in the messa |
|
|
|
|
| hey, thnks Naveed.. but 'reshape' was not helping me...
|
|
| Back to top |
|
 |
Naveed Alam
Joined: 06 Jan 2006 Posts: 292 Helped: 16
|
04 Jun 2007 8:06 Re: OFDM MAtlab Simulation - Doubt ( My code is in the messa |
|
|
|
|
Just read RESHAPE.. and try simple combinations.....
If you can convert data to serial, you can convert it back also...
e.g
a=[1 2 3;4 5 6]
e=reshape(a) %this will result 1 4 2 5 3 6
Now, if you again want to attain 'a'
reshape(e,2,3) % this will result matrix a
Will it work now for u?
Naveed
|
|
| Back to top |
|
 |