BEE ELECTRICAL Forum Index BEE ELECTRICAL
Electronics, Telecom and Electrical Engineering Related Forum
 
 BEE Electrical 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Your Ad Here
Trace my IP address

matlab code

 
Post new topic   Reply to topic    BEE ELECTRICAL Forum Index -> Communication
View previous topic :: View next topic  
Author Message
dhruva
Fresh


Joined: 03 May 2008
Posts: 1

PostPosted: Sat May 03, 2008 10:46 am    Post subject: matlab code Reply with quote

hii
i am looking for a matlab based project in wireless
e.g. ofdm (synchronisation ,channel estimation techniques)
etc
can someone provide me the docmentation and matlab code for a wireless
project
thanks
regards
dhruva
Back to top
View user's profile Send private message Send e-mail
aamirza1
Starter Level 2


Joined: 24 Apr 2008
Posts: 41

PostPosted: Sat May 03, 2008 4:42 pm    Post subject: Reply with quote

check this one



Code:
% OFDM SIMULATION:


close all;
clear all;
clc;
% Question PART-A
% IMPLEMENT AN OFDM MODEM AS A 64 POINT TRANSFORM WITH 32        % OCCUPIED  FREQUENCY BINS.in particular -16-to-1 to +1-to+16,(bin 0 empty).
 % EACH BIN IS MODULATED 16-QAM. THE TIME SERIES FORMED AT THE  OUTPUT OF   TRANSFORM IS SEPARATED BY GUARD BAND OF 16 ZERO VALUED SAMPLES LOCATED AT   BEGINNING OF OFDM FRAME. AN OFDM PACKET IS FORMED CONTAINING 50 FRAMES.

% Answer Part A

grd=zeros(1,16);
n_data=[];
for n=1:50
bin=zeros(1,64);
data_real=(floor(4*rand(1,33))-1.5)/1.5; %32+1 32 data bins and one
empty bin
data_imag=(floor(4*rand(1,33))-1.5)/1.5;
data_real(17)=0;
data_imag(17)=0;
bin(33-16:33+16)=data_real+j*data_imag;
fft_bin=ifft(fftshift(bin));
n_data=[n_data grd fft_bin];
end
figure(1);
plot(real(n_data(1:500)));
title('real part of the data');

% Question Part B
% Plot a power spectrum of the time series formed by a windowed 2048
% point fft.
% Answer part B

window=hann(length(n_data));
data_windowed=window'.*n_data;

figure(2);
plot((-0.5:1/2048:0.5-1/2048),20*log10(fftshift(abs(fft(data_windowed,2048)))));
title('windowed data power spectrum');

% Question Part C
% Answer part C
% Demodulate the ofdm packet and display the(time overlaid) real part of
% the succesive transforms as well as the (time and frequency )constellation
% diagram when there is no channel distortion

figure(3);
for mm=1:80:(4000-80)%64+16, length of n_Data=4000
     data_demodulated=fftshift(fft(n_data(mm+16:mm+79)));
     plot(0,0)
     hold on
     plot(real(data_demodulated),'or')
end
hold off
title('Real part of the demodulated OFDM packet with no channel
distortion');

figure(4);
for mm=1:80:(4000-80)
     data_demodulated=fftshift(fft(n_data(mm+16:mm+79)));
     plot(0,0)
     hold on
     plot(data_demodulated,'or')
end
hold off
title('Constellation diagram of the demodulated OFDM packet with no
channel distortion');

% Question Part D
% pass the ofdm packet through the channel . now demodulate the received
% at the receiver
% Answer part D


channel=[1 0 j*0.2 0 0 0 0 0 0 0.1];
n_data_channel=filter(channel,1,n_data);

figure(5);
plot(0,0)
hold on
for nn=1:80:(4000-80)
     
n_data_channel_demodulated=fftshift(fft(n_data_channel(nn+16:nn+79)));
     plot(real(n_data_channel_demodulated),'or')
end
hold off
title('Real part of the demodulated OFDM packet with channel
distortion');

figure(6);
plot(0,0)
     hold on
for nn=1:80:(4000-80)
     
n_data_channel_demodulated=fftshift(fft(n_data_channel(nn+16:nn+79)));
     plot(n_data_channel_demodulated,'or')
end
hold off
title('Constellation diagram of the demodulated OFDM packet with
channel distortion');


% Question PART-E
% THE 16-SAMPLE GUARD BAND OF ZERO VALUED SAMPLES IS REPLACED BY CYCLIC
% PREFIX. THE PACKET IS PASSED THROUGH THE CHANNEL AND DEMODULATED AT
% THE RECEIVER.

% Answer part E

%generating data with cyclic prefix

cycl_prefix=zeros(1,16);
n_data1=[];
for n=1:50
bin_cycl_prefix=zeros(1,64);
data1_real=(floor(4*rand(1,33))-1.5)/1.5; %32+1 32 data bins and one empty bin
data1_imag=(floor(4*rand(1,33))-1.5)/1.5;
data1_real(33)=0;
data1_imag(33)=0;
bin_cycl_prefix(33-16:33+16)=data1_real+j*data1_imag;
fft_bin_cycl_prefix=ifft(fftshift(bin_cycl_prefix));
n_data1=[n_data1 fft_bin_cycl_prefix(49:64) fft_bin_cycl_prefix];
end

%passing the data through the channel

channel=[1 0 j*0.2 0 0 0 0 0 0 0.1];
n_data1_channel=filter(channel,1,n_data1);

%Demodulate the data coming out from the channel

figure(7);
plot(0,0)
     hold on
for mm=1:80:(4000-80)
%length of the transrorm 64+data bins 16 = 80, 4000 is the length of data(n_data)
     
n_data1_channel_demodulated=fftshift(fft(n_data1_channel(mm+16:mm+79)));
     plot(real(n_data1_channel_demodulated),'or')
  end
hold off
title('Real part of the demodulated OFDM packet with cyclic prefix');

figure(8);
plot(0,0)
     hold on
for mm=1:80:(4000-80)
     
n_data1_channel_demodulated=fftshift(fft(n_data1_channel(mm+16:mm+79)));
     plot(n_data1_channel_demodulated,'or')
  end
hold off
title('Constellation diagram of the demodulated OFDM packet with cyclic prefix');



%Answer part F
%*************************************************************************************
%  Question PART-F

%  PREAMBLE IS INSERTED AT THE BEGINNING OF OFDM PACKET THAT IS FORMED BY QPSK
%  MODULATION IN ALL THE BINS OF PREAMBLE. THIS FRAME IS FORMED WITH A CYCLIC PREFIX
%  AS ARE DATA FRAMES. THE RECEIVER DEMODULATE THE PREAMBLE AND ESTIMATE THE CHANNEL
%  USING EQUATION F_rec=(F_xtd)*(F_channel). THE INVERSE ESTIMATE OF CHANNEL IS USED
%  AT EACH FREQUENCY TO NULLIFY THE EFFECT OF CHANNEL.
%**************************************************************************************

%  ofdm_802_preamble
%  forming preamble

prem_data=[];
prem_cycl_prefix=zeros(1,64);
prem_real=(floor(2*rand(1,33))-0.5)/0.5;
prem_imag=(floor(2*rand(1,33))-0.5)/0.5;
prem_real(33)=0;
prem_imag(33)=0;
prem_cycl_prefix(33-16:33+16)=prem_real+j*prem_imag;
fft_prem_cycl_prefix=ifft(fftshift(prem_cycl_prefix));
prem_data=[fft_prem_cycl_prefix(49:64) fft_prem_cycl_prefix];


% Adding the preamble in packet

data_prem_cyl_pre=[prem_data n_data1];

% Constellation diagram

figure(9);
for mm=1:80:(4000-80)
     data_demodulated=fftshift(fft(data_prem_cyl_pre(mm+16:mm+79)));
     plot(0,0)
     hold on
     plot(real(data_demodulated),'or')
end
hold off
title('Real part of the transmitted OFDM packet with preamble');

figure(10)
for mm=1:80:(4000-80)
     data_demodulated=fftshift(fft(data_prem_cyl_pre(mm+16:mm+79)));
     plot(0,0)
     hold on
     plot(data_demodulated,'or')
end
hold off
title('Constellation diagram of the transmitted OFDM packet with preamble');



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%passing the data through the channel
channel=[1 0 0.2 0 0 0 j*0.1];
n_data1_channel=filter(channel,1,data_prem_cyl_pre);


receive_prem=fft(n_data1_channel(17:80));
transmitted_prem=fft(prem_data(17:80));
channel_distortion=receive_prem./transmitted_prem;
data_recovered=[];

for n=2:50
    nn=17+(n-1)*80;
    new_data=fft(n_data1_channel(nn:nn+63))./channel_distortion;
    data_recovered=[data_recovered new_data];
end   

%Demodulate the data coming out from the channel

figure(12);
plot(0,0)
     hold on
for mm=1:80:(data_recovered)
     
%n_data1_channel_demodulated=fftshift(fft(data_recovered(mm+32:mm+159)));
     plot(real(data_recovered),'or')
  end
hold off
title('Real part of the demodulated OFDM packet with preamble');

figure(13);
plot(0,0)
     hold on
for mm=1:80:(data_recovered)
   
%n_data1_channel_demodulated=fftshift(fft(data_recovered(mm+32:mm+159)));
     plot(data_recovered,'or')
  end
hold off
title('Constellation diagram of the demodulated OFDM packet with preamble');
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    BEE ELECTRICAL Forum Index -> Communication All times are GMT + 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

Hosted by ForumCity