Professional Documents
Culture Documents
Solution To Microwave Engineering Pozar Chapter 14 Example 6 With MATLAB
Solution To Microwave Engineering Pozar Chapter 14 Example 6 With MATLAB
EXAMPLE 14.6
Click any to open the MATLAB script solving this exercise. Run script to read question and calculate solution.
On 1st run, the exercise is solved and the results are stored in .mat file. Parameters can be modified to solve
exercise variations. MATLAB student licences are cheap and there is a type that does not even require to be
registered in any university or college. All comments welcome.
To download and install MATLAB as well as review help on specific commands click any MATLAB icon:
The question for this example in [POZAR] pg683 does not reveal carrier frequency, thus cannot be calculated and the example couldn't be solved.
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 1/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
pozar_14_example_06.m
lambda0=c0/f0 lambda0 =
0.018750000000000
L0=4*pi*R/lambda0 L0 =
6.299940467998732e+08
L0_dB=20*log10(L0) L0_dB =
1.759867289111611e+02
Prx_dBm=Ptx_dBm+Gtx_dB-L0_dB-Latm_dB+Grx_dB Prx_dBm =
-1.079558290412417e+02
Prx_target_dBm=Prx_dBm-LM_dB Prx_target_dBm =
-1.179558290412417e+02
Prx_target=10^((Prx_target_dBm-30)/10) % [W] Prx_target =
1.601094980064552e-15
We aim at building a system with Px_target, not Prx because of fading, interference and atmosphere factors that cannot be controlled.
So what EbN0 to build signals so that BER requirements are met? Too much power and radiation regulations may be breached incurring fines and
endangering inadvertent users and public. Not enough power and the applications running on such channels will falter, customers will suffer reduced
Quality of Service, and like trust, convincing customers to purchase mobile phones takes expensive marketing campaigns, yet it may be lost really quickly
when health and safety issues go public, problems that should be caught and solve before prototypes reach production lines.
[POZAR] simplifies with a 'conservative' reading of the supplied BER(EbN0) graph, rounding up to 5dB, which is also reasonable, given tight Link Margins
that systems have to be built upon otherwise putting too much budget on back-off may turn a waste of investment and even the reason why a product
doesn't sell, because price too high compared to less robust system, yet getting in with the right price.
Theoretical BER(EbN0)
BER(EbN0) functions are probability Density Distributions that are modulation and channel dependent.
Also, probability density functions only resemble what is really happens, happened, or is going to happen, beside the obvious if-enough-samples, when
there's enough signal level, enough Watts, even for CDMA and spread spectrum signals, or/and symbols spaced wide enough for errors not to happen 'too
often'.
figure;
ax1=gca
for k=1:1:numel(M)
theoreticalBER = 0.5*erfc(sqrt(EbN0lin*sin(pi/M(k))));
semilogy(EbN0dB,theoreticalBER,c1(k),'LineWidth',1.5);
hold(ax1,'on');
end
[POZAR] searches for 'rayleigh' and 'rician' return a handful of chapters not related to wireless channel models. I also checked for 'rician', and all have to
do with basics of device electromagnetic noise and one left for radar.
AWGN is the mildest of the wireless channels that base stations and mobile phones use, if lucky to come across one.
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 3/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
bpsk_over_rayleigh.m
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 4/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
BPSK/QPSK based modulations allow less signal power to achieve same (low enough) BER compared to FSK and ASK, thus 'protecting' payload in carrier
phase instead of on amplitude of frequency is the preferred choice in most modern systems that have to stand noise interference jamming eavesdropping
and the lot real problems of real communications scenarios.
References
[1] Digital Modulations using MATLAB, build simulation models from scratch
author: Mathuranathan Viswanathan
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 5/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
clear all;clc;
%---------Input Fields------------------------
N=1000000;%Number of symbols to transmit
EbN0dB = -4:2:20; % Eb/N0 range in dB for simulation
%-----------------Transmitter---------------------
a= randi([0,1],1,N); %uniformly distributed random 1's and 0's
s = 2*a-1; %BPSK Mapping
SER = zeros(length(EbN0dB),1); %Place holder for SER values for each Eb/N0
EbN0lin = 10.^(EbN0dB/10); %Converting Eb/N0 from dB to linear scale
for i=1:1:length(EbN0dB),
%Compute and add channel noise for given Eb/N0
Esym=sum(abs(s).^2)/(length(s)); %calculate actual symbol energy from generated samples
N0=Esym/EbN0lin(i); %find the noise spectral density
noiseSigma = sqrt(N0/2); %standard deviation for AWGN Noise
n = noiseSigma*(randn(1,N)+1i*randn(1,N));
y=s+n;%received signal = signal+awgn noise
%---------------Receiver--------------------
acap=(y>=0);%threshold detection
SER(i)=sum((a~=acap))/N;%------ Symbol Error Rate Computation-------
end
%------Theoretical Symbol Error Rate-------------
theoreticalSER = 0.5*erfc(sqrt(EbN0lin));
%-------------Plotting---------------------------
semilogy(EbN0dB,SER,'k*'); hold on;
semilogy(EbN0dB,theoreticalSER,'r-');
set(gca,'XLim',[-4 12]);set(gca,'YLim',[1E-6 1E0]);set(gca,'XTick',-4:2:12);
title('Probability of Symbol Error for BPSK signals');
xlabel('E_b/N_0 (dB)');ylabel('Probability of Symbol Error - P_s');
legend('Simulated', 'Theoretical');grid on;
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 6/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
% Demonstration of Eb/N0 Vs BER for baseband BPSK modulation scheme over Rayleigh Fading
clear all; clc;
%---------Input Fields------------------------
N=1000000;%Number of symbols to transmit
EbN0dB = -4:2:20; % Eb/N0 range in dB for simulation
M=2; %2-PSK
%-----------------Transmitter---------------------
a= randi([0,1],1,N); %uniformly distributed random 1's and 0's
s = 2*a-1; %BPSK Mapping
for i=1:1:length(EbN0lin),
%----------------Channel---------------------
%Adding noise with variance according to the required Es/N0
Esym=sum(abs(s).^2)/(length(s)); %Calculate actual symbol energy from generated samples
N0=Esym/EbN0lin(i); %Find the noise spectral density
noiseSigma = sqrt(N0/2); %Standard deviation for AWGN Noise
n = noiseSigma*(randn(1,N)+1i*randn(1,N));%computed noise
%---------------Receiver--------------------
yRayleighEqualized=y_rayleigh./h;%Equalizer for Rayleigh Channel
aCapRayleigh=(yRayleighEqualized>=0); %BPSK detection for signal through Rayleigh channel
aCapAWGN=(y_awgn>=0); %BPSK detection for signal through AWGN channel
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 7/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
%Eb/N0 Vs BER for BPSK over Rician Fading Channel with AWGN noise
clc; clear all;
%--------Inputs-------------------------------------------------
N=10^6; %Number of data samples to send across the Rician Channel
EbN0dB=0:2:20; %Eb/N0 in dB overwhich the performance has to be simulated
K_factors=[0 2 5 10 20 30 10000]; %a list of Ricial K factors to simulate
%--------------------------------------------------------------
plotStyle={'b*-','ro-','kx-','gs-','md-','cp-','yv-'};
for index =1:length(K_factors)
kappa=K_factors(index);
S=sqrt(1/(kappa+1));%power of scattered components
A=sqrt(kappa/(kappa+1));%power of LOS components
for i=1:length(EbN0dB)
g_t=1/sqrt(2)*(randn(1,N)+1i*randn(1,N)); %Rayleigh Fading - complex Gaussian RV
h=(A+S*g_t); %Rician Fading from Rayleigh Fading
%---------------Receiver--------------------
y_ricean_cap=y_ricean./h; %Equalizer - assuming that h is known at the receiver accurately
r_ricean=real(y_ricean_cap)>0; %threshold detector for BPSK
simBER_ricean(i)=sum(xor(a,r_ricean));%calculate total bit Errors
end
simBER_ricean=simBER_ricean/N;%Bit Error rates;
semilogy(EbN0dB,simBER_ricean,plotStyle{index},'LineWidth',1.0);hold on
legendInfo{index} = ['K = ' num2str(K_factors(index))];
end
axis([0 20 10^-5 10^0]);legend(legendInfo);
title('Performance of BPSK over Rician Channels with AWGN noise');
xlabel('Eb/N0(dB)');ylabel('Pb -Bit Error Rate');
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 8/9
POZAR chapter 14: RF MICROWAVE SYSTEMS. Example 06 __ 05/11/2020 13:10:08.
for i=1:length(EbN0dB),
Eb=OF*sum(abs(s).^2)/(length(s)); %compute energy per bit
N0= Eb/EbN0lin(i); %required noise spectral density from Eb/N0
n = sqrt(N0/2)*(randn(1,length(s)));%computed noise
r = s + n;%add noise
a_cap = qpsk_demod(r,fc,OF); %QPSK demodulation
BER(i) = sum(a~=a_cap.')/N;%Bit Error Rate Computation
end
%------Theoretical Bit Error Rate-------------
theoreticalBER = 0.5*erfc(sqrt(EbN0lin));%Theoretical bit error rate
%-------------Plot performance curve------------------------
figure;semilogy(EbN0dB,BER,'k*','LineWidth',1.5); %simulated BER
hold on; semilogy(EbN0dB,theoreticalBER,'r-','LineWidth',1.5);
title('Probability of Bit Error for QPSK modulation');
xlabel('E_b/N_0 (dB)');ylabel('Probability of Bit Error - P_b');
legend('Simulated', 'Theoretical');grid on;
This exercise is part of the collection of exercises Microwave Engineering POZAR 4th ed solved with MATLAB available in this website:
https://jgb2012.wixsite.com/microwave-eng-matlab
_____________________________________________________________________________________________________________________________ _
John Bofarull Guix jgb2012@sky.com jgb2014@live.co.uk 9/9