my questions are: what is the relation between the fft size and the cyclic prefix , coz by changing the fft size to for example to 512 it gave error in the line of cp(count1,:) = cyclicpad(outifft,64); ....

2 views (last 30 days)
fftlength = 2048; %nd = 6; BW = 20e6; FS = 2*BW; % Sampling Frequency NS = 2048;% No. of Subcarriers %nsym = 1e4; % number of OFDM symbol
%,,,,,,,,,,,,,,,,,main program,,,,,,,,,,,,,,,,
% Input Generation x = rand(1,NS)>0.5; %x= randi([0,1],nsym*NS,1); % Conversion of data from serial to parallel p = series2parallel(x,NS); % M ary Modulation of PSK and QAM M = 2; X = 0; for count1 = 2:1:7; if (M==2||M==4||M==16||M==64) M = M+X % M-ary modulation for producing y. if(M<=8) % Modulation for PSK y=modulate(modem.pskmod(M),p); else % Modulation for QAM y=modulate(modem.qammod(M),p); end ylen = length(y); %Applying Mapping %q_out = ofdma_mapping(y,ylen); % Apply IFFT operation outifft = ifft(y,ylen); % Cyclic Prefix Addition cp(count1,:) = cyclicpad(outifft,64); % Length of CP cplength = length(cp); % Conversion of data from parallel to serial out = reshape(cp(count1,:),1,cplength); % Signal transmits through AWGN channel. ynoisy = awgn(out,100,'measured'); % Addition of Rayleigh Fading c = rayleighchan(1/1000,100,[0 2e-5],[0 -9]); rf = filter(c,ynoisy); % Conversion of data from serial to parallel p2 = series2parallel(rf,cplength); re_par = real(p2); % Remove cyclic prefix rcp(count1,:) = decyclicpad(p2,64); rcplength = length(rcp); % FFT zzfft = fft(rcp(count1,:),fftlength); %Apply Demapping %qq_out = ofdma_demapping(zzfft,fftlength); outfft = zzfft,fftlength; % %Applying IFFT % zfft = ifft(qq_out); if (M<=8) % Demodulation of PSK at Reciever z=demodulate(modem.pskdemod(M),outfft); else % Demodulation of QAM at Reciever z=demodulate(modem.qamdemod(M),outfft); end % Conversion of data from parallel to serial xdash = reshape(z,1,NS) berr = 0 ; for a = 1:1:NS; if (xdash(:,a) == x(:,a)) berr = 0; else berr = berr+1; end end tberr(count1,:) = berr; Eb_No = 0:1:NS-1; Eb_No = 0.4*Eb_No; if(M<=8) ber(count1,:) = berawgn(Eb_No,'psk',M,'nondiff'); Pe(count1,:) = erfc(sqrt(0.9*Eb_No)*sin(pi/M)); else ber1(count1,:) = berawgn(0.9*Eb_No,'qam',M); Pe(count1,:) = 2*((1-(1/sqrt(M)))*erfc(sqrt((1.5*Eb_No)/(M-1)))); end for init = 1:1:32 switch M end end end M= 2^count1; end

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!