Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

OFDMA Simulation _ problem with only one function how> what is the use of it?

Status
Not open for further replies.

baperbook

Newbie level 5
Joined
Oct 4, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,360
PLEASE TELL ME THE USE AND HOW TO BUILd THE FUNCTION, "ofdma_mapping",in this code, THAT CAN DO THE WORK OF "q_out=ofdma_mapping(y,ylen)" Here is the code. Please help and So many thanks in advance. % Number of Subcarriers NS=512; % Input Generation x=rand(1,NS)>0.5; fftlength=512; nd=6; BW=5e6; FS=2*BW;%Sampling Frequency % Conversion of data from serial to parallel p=series2parallel(x,NS); % M-ary Modulaton of PSK & 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 %Moodulation for QAM end ylen=length(y); %Applying Mapping q_out=ofdma_mapping(y,ylen); %Apply IFFT operation outifft=ifft(q_out); %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 relay 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=qq_out; %% Applung 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
figure()
%Plot SNR and BER
semilogy(Eb_No,ber(2,:),'k',Eb_No,ber(3,:),'g',Eb_No,ber1(5,:),'b',Eb_No,ber1(7,:),'r');
axis([ 25 0.0001 1]);
xlabel('SNR[dB]')
ylabel('BER')
legend('BPSK','QPSK','16-QAM','64-QAM')
figure()
%Plot Error Probability
semilogy(Eb_No,Pe(2,:),'k',Eb_No,Pe(3,:),'r',Eb_No,Pe(5,:),'b',Eb_No,Pe(7,:),'g');
axis([0 50 0.0001 1]);
xlabel('SNR[dB]')
ylabel('Probability of Error')
legend('BPSK','QPSK','16-QAM','64-QAM')
title('OFDMA')
h=spectrum.periodogram;
figure()
HS=psd(h,outifft,'SpectrumType','twosided','NFFT',NS,'FS',FS);
plot(HS)
xlabel('Sampling Frequency (2 * BW)in MHz')
ylabel('Power Spectral Density [dBm/Hz]')
title('OFDMA')
grid off;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top