You are on page 1of 3

%mevada jainal jankkuamr clc; close all; clear all; actual_data=1024 M=16 no_of_Symbol=1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%for qam fft = 512

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% % transmitter:%DATA GENERATOR no_of_subcarrier = 512 ifft_pt=no_of_subcarrier fft_pts=ifft_pt data1=no_of_Symbol*actual_data data=randsrc(1,data1,0:M-1) figure(1) stem(data) title('transmit data') hold on; % MODUALTION Mod_data=qammod(data,M) % figure(15) % plot(Mod_data) scatterplot(Mod_data) % h=spectrum.periodogram % psd(h,Mod_data) no_of_col=length(Mod_data)/no_of_subcarrier data_mat=reshape(Mod_data,no_of_subcarrier,no_of_col) for i=no_of_col ifft_data(:,i)=ifft((data_mat(:,i)),ifft_pt) end % plot(ifft_data) [rows_ifft_data col_ifft_data]=size(ifft_data) len_ofdm_data = rows_ifft_data*col_ifft_data ofdm_signal = reshape(ifft_data, 1, len_ofdm_data) figure(3) plot(abs(ofdm_signal)) title('after ifft') grid on; y = awgn(ofdm_signal,10,'measured') % figure(5) % plot(y) %%%% receiver:recved_sig=y % figure(6) % plot(y) recved_sig_mat=reshape(recved_sig,rows_ifft_data,col_ifft_data) % FFT for i=1:col_ifft_data, fft_data_mat(:,i) = fft(recved_sig_mat(:,i),fft_pts); end recved_serial_data = reshape(fft_data_mat, 1,(no_of_subcarrier*no_of_col)) figure(5)

plot(abs(recved_serial_data)) title('ofdm specrum afer fft') demod_data = qamdemod(recved_serial_data,M) scatterplot(demod_data) figure(7) stem(demod_data,'rx'); title('received data') grid on; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % %%%%%%%%%%%%%%%% for qam fft=1024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% no_of_subcarrier1 = 1024 ifft_pt1=no_of_subcarrier1 fft_pts1=ifft_pt1 % transmitter:%DATA GENERATOR data2=no_of_Symbol*actual_data data3=randsrc(1,data2,0:M-1) figure(6) stem(data3) title('transmit data') hold on; % MODUALTION Mod_data1=qammod(data3,M) % figure(15) % plot(Mod_data1) % scatterplot(Mod_data1) % h=spectrum.periodogram % % psd(h,Mod_data) % no_of_col1=length(Mod_data1)/no_of_subcarrier1 data_mat1=reshape(Mod_data1,no_of_subcarrier1,no_of_col1) for l=1:no_of_col1 ifft_data1(:,l)=ifft((data_mat1(:,l)),ifft_pt1) end % plot(ifft_data) [rows_ifft_data1 col_ifft_data1]=size(ifft_data1) len_ofdm_data1 = rows_ifft_data1*col_ifft_data1 ofdm_signal1 = reshape(ifft_data1, 1, len_ofdm_data1) figure(8) plot(abs(ofdm_signal1)) title('after ifft 1024') grid on;

y1 = awgn(ofdm_signal1,10,'measured') % figure(9) % plot(y1)

% receiver:recved_sig1=y1 % figure(6) % plot(y) recved_sig_mat1=reshape(recved_sig1,rows_ifft_data1,col_ifft_data1) % FFT for k=1:col_ifft_data1, fft_data_mat1(:,k) = fft(recved_sig_mat1(:,k),fft_pts1); end recved_serial_data1 = reshape(fft_data_mat1, 1,(no_of_subcarrier1*no_of_col1)) figure(9) plot(abs(recved_serial_data1));grid title('after fft 1024') demod_data1 = qamdemod(recved_serial_data1,M) scatterplot(demod_data1) grid; figure(11) stem(demod_data1,'rx'); title('received data fft = 1024') grid on;