demodulation problem

1 view (last 30 days)
itsik
itsik on 18 May 2011
hello i've tried to make demodulation for this program but i have a problem i think the command 'pwelce' make the 2058 bits into 4096 bits because the fft how does i make it 2058 bits again like the ipMod? thank u very much! this is the code:
clear all
nFFTSize =64 ;
% for each symbol bits a1 to a52 are assigned to subcarrier
% index [-26 to -1 1 to 26]
subcarrierIndex = [-26:-1 1:26];
nBit = 2500;
ip = rand(1,nBit) > 0.5; % generating 1's and 0's
nBitPerSymbol = 52;
nSymbol = ceil(nBit/nBitPerSymbol);
% BPSK modulation
% bit0 --> -1
% bit1 --> +1
ipMod = 2*ip - 1; %2500 {0 or 1]
ipMod = [ipMod zeros(1,nBitPerSymbol*nSymbol-nBit)]; % 1 x 2548
ipMod = reshape(ipMod,nSymbol,nBitPerSymbol); % 49 x 52
figure(1)
plot(ipMod)
st = []; % empty vector
for ii = 1:nSymbol
inputiFFT = zeros(1,nFFTSize);
% assigning bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]
inputiFFT(subcarrierIndex+nFFTSize/2+1) = ipMod(ii,:);
% shift subcarriers at indices [-26 to -1] to fft input indices [38 to 63]
inputiFFT = fftshift(inputiFFT);
outputiFFT = ifft(inputiFFT,nFFTSize);
% adding cyclic prefix of 16 samples
outputiFFT_with_CP = [outputiFFT(49:64) outputiFFT];
st = [st outputiFFT_with_CP];
end
close all
fsMHz = 20;
[Pxx,W] = pwelch(st,[],[],4096,20);
figure(2)
plot([-2048:2047]*fsMHz/4096,10*log10(fftshift(Pxx)));
xlabel('frequency, MHz')
ylabel('power spectral density')
title('Transmit spectrum OFDM (based on 802.11a)');

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!