0% found this document useful (0 votes)
17 views56 pages

Contents

Uploaded by

ly8795369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views56 pages

Contents

Uploaded by

ly8795369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Contents

1. Introduction.........................................................................................3
2. Bit Error over AWGN and RAYLEIGH Fading Channels ............4
2.1. PDF-based approach for binary signal ..................................................... 4
2.2. Bit Error over Gaussian channel ............................................................. 4
2.3. Bit Error over fading channel .................................................................. 5
3. Flowchart 6
4. THE MATLAB CODE .......................................................................8
5. Introduction....................................................................................... 11
6. The Probability of Bit Error When Employing MRC and BPSK
modulation 12
7. Flowchart 13
8. THE MATLAB CODE .....................................................................15
9. Introduction.......................................................................................19
10. 2. normalized radiation pattern ......................................................21
11. Flowchart 22
11.1. 3.1 Flowchart of Normalized radiation pattern for a non-weighted two-sensor
array. ...................................................................................................... 22
12. THE MATLAB CODE .....................................................................24
12.1. 4.1 MATLAB code of Normalized radiation pattern for a non-weighted two-
sensor array.............................................................................................. 24
1. Introduction.......................................................................................28
13. normalized radiation pattern ..........................................................30
14. Flowchart 31
14.1. 3.1 Flowchart of Normalized radiation pattern for a weighted two-sensor
array. ...................................................................................................... 31
15. THE MATLAB CODE .....................................................................33
15.1. 4.1 MATLAB code of Normalized radiation pattern for a weighted two-sensor
array. ...................................................................................................... 33
16. 45
17. 3. Flowchart.......................................................................................45
18. Introduction.......................................................................................48
19. Laws and equations ..........................................................................50
20. Flowchart 51
21. THE MATLAB CODE .....................................................................54

1|Page
2|Page
1. Introduction
In our experience, we will explore the behavior of Binary Phase Shift
Keying (BPSK) modulation when subjected to two common channel
models: Additive White Gaussian Noise (AWGN) and Rayleigh
fading. Our objective is to use MATLAB simulations to depict the bit
error rate (BER) performance of BPSK modulation. We will assess the
signal’s robustness against the distinct obstacles introduced by these
channels. The analysis will not only highlight the durability of BPSK
modulation across different scenarios but will also emphasize the value of
diversity strategies in overcoming signal deterioration.

FIGURE 3.4: Bit error probability for BPSK modulation over AWGN and Rayleigh fading channels.

3|Page
2. Bit Error over AWGN and RAYLEIGH Fading
Channels
2.1. PDF-based approach for binary signal
A fading channel can be considered as an AWGN with a
variable gain. The gain itself is considered as a
RV(Random variable) with a given pdf. So the average
BER can be calculated by averaging BER for

instantaneous SNR over the distribution of SNR:


The BER is expressed by a Q-function as seen in previous
chapter:

2.2. Bit Error over Gaussian channel


In a BPSK system the received signal can be written as:
y=x+n (1)
where x ∈ {−A,A}, n ∼ CN(0,σ2) and σ2 = N0. The real part of the above
equation is yre = x + nre where nre ∼ N(0,σ2/2) = N(0,N0/2). In BPSK
constellation dmin = 2A and γb is defined as Eb/N0 and sometimes it is
called SNR per bit. With this definition we have:

(2)
So the bit error probability is:

(3)
This equation can be simplified using Q-function as:

(4)
where the Q function is defined as:
4|Page
(5)

2.3. Bit Error over fading channel


Rayleigh fading channel with coherent detection:
The received signal in a Rayleigh fading channel is of
the form:
y = hx + w
where h is the channel attenuation with normal distribution h ∼
CN(0,1) and n is a white additive noise w ∼ CN(0,N0). The coherent
receiver constructs the following metric from the received signal:
h∗y = |h|2x + h∗w (6)

Using BPSK modulation and since the information are real, only the
real part of the equation is of interest. So the following sufficient
statistic is used for decision at the receiver.

(7)
The noise n has the same statistics as <w because h∗/|h| = exp(jθ)
with θ uniformly distributed in (0,π), therefore n ∼ CN(0,N0/2). This
equation shows that we have a normal AWGN channel with the
signal scaled by |h|. The bit error probability as seen before for this
case, given h, will be:

Now, we compute the SER by averaging this BER over the


distribution of h. Since h is complex Gaussian, the distribution of r =
|h|2 will be exponential with:

Therefore the signal-to-noise-ratio distribution γ = |h|2γb will be:

5|Page
The error probability can be calculated by:

Using the following form of Q-function and MGF(moment


generating function) function, the integral can eb calculated.

3. Flowchart
This is the flowchart to guide the MATLAB code for calculating a
plotting the bit error probability for BPSK modulation over AWGN a
Rayleigh fading channels:

1) Start
o Begin the process.

2) Initialize Variables

o Define ( 𝑬𝒃 /𝑵𝟎) range (in dB): This is the range of signal-to-noi


ratio values for which you want to calculate the bit err
probability.

o Convert ( 𝑬𝒃/𝑵𝟎) from dB to linear scale.


3) Calculate Average SNR per Bit (𝜸𝒃)

o Use the formula (𝜸𝒃 = 𝟏𝟎(𝑬𝒃⁄𝑵𝟎 𝒅𝑩) ).

4) Calculate Bit Error Probability for AWGN


o Use the formula:

5) Calculate Bit Error Probability for Rayleigh Fading


o Use the formula:

6|Page
6) Plot Results
o Plot ( 𝑬𝒃/𝑵𝟎) versus (𝑷𝒃) for both AWGN and Rayleigh fading on
a semilogarithmic scale.
o Label the axes and the graph.
7) End

Figure 1

7|Page
4. THE MATLAB CODE
% Number of bits or symbols
N = 10^6;

% Define the SNR range in dB


snr_dB = 0:1:30; % From 0 to 30 dB

% Convert SNR from dB to linear scale


snr_linear = 10.^(snr_dB/10);

% Generate random binary data


data = randi([0 1], 1, N);

% BPSK modulation (0 -> -1, 1 -> 1)


modulated_data = 2*data - 1;

% Initialize BER arrays


ber_awgn = zeros(1, length(snr_dB));
ber_rayleigh = zeros(1, length(snr_dB));

% Simulate for each SNR value


for i = 1:length(snr_dB)
% AWGN noise
noise_awgn = sqrt(1/(2*snr_linear(i))) * randn(1, N);
received_awgn = modulated_data + noise_awgn;
detected_awgn = received_awgn >= 0;
ber_awgn(i) = sum(detected_awgn ~= data) / N;

% Rayleigh fading
rayleigh = sqrt(1/2) * (randn(1, N) + 1i*randn(1, N));
received_rayleigh = modulated_data .* rayleigh + noise_awgn;
received_rayleigh = received_rayleigh ./ rayleigh; % Equalization
detected_rayleigh = real(received_rayleigh) >= 0;
ber_rayleigh(i) = sum(detected_rayleigh ~= data) / N;
end

% Plotting the results


figure;
semilogy(snr_dB, ber_awgn, 'b-', 'LineWidth', 2);
hold on;
semilogy(snr_dB, ber_rayleigh, 'r--', 'LineWidth', 2);

8|Page
hold off;

% Graph annotations
title('Bit Error Probability for BPSK Modulation');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
legend('AWGN Channel', 'Rayleigh Fading Channel');
grid on;

Figure 2

9|Page
10 | P a g e
5. Introduction
The selection combining technique is the simplest technique, where in,
the received signal from the antenna that experiences the highest SNR
(i.e, the strongest signal from N received signals) is chosen for processing
at the receiver. Therefore this technique throws away (N-1) of N
observations. Whereas, in maximum ratio combining (MRC) all N
observations are used.

MRC works on the signal in spatial domain and is very similar to what a
matched filter in frequency domain does to the incoming signal. MRC
maximizes the inner product of the weights and the signal vector.

Figure 3

The maximum ratio combining technique, uses all the received signal
elements (Figure 1), it weighs them and combines the weighted signals so
that the output SNR is maximized. Requiring the knowledge of the
individual channels , the weights are chosen as

With the weights set as , the output of the MRC combiner is

Therefore, the output SNR after MRC processing is


11 | P a g e
MRC processing results in the weighted average of the received signals
and hence the overall output SNR is equal to the sum of the SNRs of all
individual receive signals, which yields the maximum possible diversity
gain of . This is the maximum achievable SNR for all possible receive
diversity schemes (selection combining, equal gain combining, etc..,).
Generally, two figures of merits are used to gauge the performance of the
diversity schemes – outage probability and error rate performance for PSK
modulation.

6. The Probability of Bit Error When Employing


MRC and BPSK modulation
the probability of bit error is given by

12 | P a g e
7. Flowchart
This is the flowchart to guide the MATLAB code for calculating a
plotting the bit error probability for BPSK modulation over AWGN a
Rayleigh fading channels:

4) Start
o Begin the process.

2)Define Parameter

- SNR_dB = 0:5:40
- SNR = 10.^(SNR_dB/10)

3) Define BER Function for MRC

- bet_mrc = @(L, SNR) (1/2).*(1 - sqrt(SNR./(1 + SNR))).^L .*


sum(cell2mat(arrayfun(@(l) nchoosek(L-1+l, l) .* (SNR./(1 +
SNR)).^l, 0:L-1, 'UniformOutput', false)));

4)Initialize BER Array

- L_values = [1, 2, 3, 4]
- BER = zeros(length(L_values), length(SNR))

5) Loop Over L_values

- For i = 1:length(L_values)
- Set L = L_values(i)
- Compute BER(i, :) = ber_mrc(L, SNR)

6) Plot Results
o Plot ( 𝑬𝒃/𝑵𝟎) versus (𝑷𝒃) for both AWGN and Rayleigh fading on
a semilogarithmic scale.
o Label the axes and the graph.
7) End

13 | P a g e
Figure 4

14 | P a g e
8. THE MATLAB CODE
% MATLAB code to plot the BER performance of MRC diversity for different
numbers of branches (L)
% Parameters
SNR_dB =0:5:40; % Signal-to-noise ratio in dB
SNR = 10.^(SNR_dB/10); % Linear scale SNR
% Calculate BER for AWGN (M=1)
Pb = 0.5*erfc(sqrt(SNR));
% Function to calculate BER for MRC
ber_mrc = @(L, SNR) (1/2).*(1 - sqrt(SNR./(1 + SNR))).^L .*
sum(cell2mat(arrayfun(@(l) nchoosek(L-1+l, l) .*(0.5*(1+ sqrt(SNR./(1 +
SNR)))).^l, 0:L-1, 'UniformOutput', false)));
% BER calculations for different L values
L_values = [1, 2, 3, 4];
BER = zeros(length(L_values), length(SNR));

for i = 1:length(L_values)
L = L_values(i);
BER(i, :) = 0.25*ber_mrc(L, SNR);
end

% Plotting
figure;
% Plot AWGN channel (solid line)
semilogy(SNR_dB, Pb, 'k-' ,'DisplayName', 'AWGN chanel');
hold on;

semilogy(SNR_dB, BER(1,:), '-o', 'DisplayName', 'L = 1');


semilogy(SNR_dB, BER(2,:), '-s', 'DisplayName', 'L = 2');
semilogy(SNR_dB, BER(3,:), '-d', 'DisplayName', 'L = 3');
semilogy(SNR_dB, BER(4,:), '-^', 'DisplayName', 'L = 4');
hold off;

xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
title('BER Performance of MRC Diversity for Different Numbers of
Branches');
% Set the y-axis limits
ylim([10^-7 1]);

legend;
grid on;

15 | P a g e
Figure 5

16 | P a g e
17 | P a g e
18 | P a g e
9. Introduction
A device able to receive or transmit electromagnetic energy is called an
antenna. Antennas have become ubiquitous devices and occupy a salient
position in wireless system experienced the largest growth among
industry systems. Antennas couple electromagnetic energy from one
medium (space) to another medium as wire, coaxial cable, or waveguide.
Physical designs can vary greatly. Antenna produces complex
electromagnetic fields both near to and far from antennas. Not all of the
electromagnetic fields generated actually radiated into space. Some of the
fields remain in the vicinity of antenna and are viewed as reactive near
fields; much the same way as inductor or capacitor is a reactive storage
element in lumped element circuits.

Smart Antenna

The concept of using multiple antennas and innovative signal processing


to serve cells more intelligently has existed for many years. In fact,
varying degrees of relatively costly smart antenna systems have already
been applied in defence systems. Until recent years, cost barriers have
prevented their use in commercial systems .The advent of powerful, low-
cost digital signal processors (DSPs), general-purpose processors (and
ASICs), as well as innovative software-based signal-processing
techniques (algorithms) have made intelligent antennas practical for
cellular communications systems. Smart antenna systems are the
technology of uniting not only antenna technology but also two or more
of other technology as digital signal processors and high function of
antennas. Today, when spectrally efficient solutions are increasingly a
business imperative, these systems are providing greater coverage area
for each cell site, higher rejection of interference, and substantial capacity
improvements. That can overcome the problem in high speed mobile
communication such as limited channel bandwidth while satisfying the
demand for many mobiles in a limited channel. In truth, antennas are not
smart, antenna systems are smart. Generally co-located with a base
station, a smart antenna system combines an antenna array with a digital
signal-processing capability to transmit and receive in an adaptive,
spatially sensitive manner. In other words, such a system can
automatically change the directionality of its radiation patterns in
response to its signal environment. Smart antennas also known as
adaptive array antennas, multiple antennas and recently MIMO that are
antenna arrays with smart signal processing algorithms used to identify
spatial signal signature such as the direction of arrival of the signal, and
use it to calculate beamforming vectors, to track and locate the antenna
19 | P a g e
beam on the mobile/target. The antenna could optionally be any sensor.
This can dramatically increase the performance characteristics (such as
capacity) of a wireless system.

ULA - Algorithm:
We can explain the functioning principle of a “smart” antenna using a
simple example. In the example, we consider a uniform linear array
(ULA) consisting of two identical Omni-directional sensors as shown in
Figure 1 .We assume that a signal is generated by a source in the far-
field of the “smart” antenna. The impinging signal on the sensor array is
approximately a uniform plane wave, as shown in Figure 1. With respect
to sensor 1, sensor 2 experiences a time delay of

(2)
Where d is the spacing between the two elements and the wave speed.
Similarly, knowing d and measuring , the angle of the direction of
arrival is found using
(3)
If is a narrowband signal with carrier frequency , then the time delay
corresponds to a phase shift of

(4)
Where is the wavelength corresponding to the carrier frequency, i.e.
. Clearly, for an incoming signal from a direction perpendicular to the array
normal , both the time delay and phase shift between the two sensors
are zero.

Figure 1: Uniform Linear Array (ULA)

20 | P a g e
Figure 2

Figure 2: Normalized radiation pattern for a non weighted two-sensor


array. Figure 2 shows the normalized radiation pattern for a two
element antenna array.

10. 2. normalized radiation pattern


The normalized radiation pattern of an N-element ULA of
omnidirectional elements with inter-element spacing d is given in dB by

where w is the N-dimensional vector consisting of the complex weights of the


antenna elements.

21 | P a g e
11. Flowchart
11.1. 3.1 Flowchart of Normalized radiation pattern for a
non-weighted two-sensor array.
1. Initialize Parameters:
- Define `N` as the number of elements in the array, which is 2 in this
case.
- Set `d` as the spacing between the elements in wavelengths, which is
0.5 wavelengths.
2. Define the Range of Angles:
- Set `theta`, an array representing the range of angles from (-pi) to (pi)
(or -180 degrees to 180 degrees), with an increment of 0.01 radians.
This covers a full 360-degree span.
3. Initialize the Radiation Pattern:
- Create an array `pattern` initialized to zero, with the same size as
`theta`. This array will store the calculated radiation pattern values.
4. Calculate the Radiation Pattern:
- Loop through each angle `k` in `theta`:
- Calculate the steering vector `a` for the current angle `theta(k)`. This
vector accounts for the phase difference caused by the geometry and
element spacing.
- Compute the array factor for the current angle This formula calculates
the power of the signal received from the direction specified by
`theta(k)`.
- Store the computed array factor in `pattern(k)`.
5. Normalize the Radiation Pattern:
- Convert `pattern` into decibels (dB) relative to its maximum value.
This is done by dividing the entire `pattern` by its maximum value to
normalize it, then converting this normalized pattern to dB.

6. Plot the Radiation Pattern:


- Plot `pattern_dB` against `theta` converted to degrees on the x-axis.

22 | P a g e
- Set the plot title to 'Normalized Radiation Pattern for a Non-Weighted
Two-Sensor Array'.
- Label the x-axis as 'Angle (degrees)' and the y-axis as 'Normalized
Gain (dB)'.
- Enable the grid and set axis limits for clarity in visualization, focusing
the x-axis from -180 to 180 degrees and y-axis to display gains
effectively.
7. End of Algorithm
- This algorithm clearly outlines the process to compute and visualize
the radiation pattern for a simple two-element antenna array with
uniform weighting, which is useful for understanding the directional
properties of array antennas in signal processing and
communications.

23 | P a g e
12. THE MATLAB CODE
12.1. 4.1 MATLAB code of Normalized radiation pattern
for a non-weighted two-sensor array.
% Define the number of elements and the spacing between them
N = 2; % Number of elements in the array
d = 0.5; % Spacing between elements in wavelengths

% Define the weights for the array elements as uniform weights


w = [1; 1]; % Uniform weights for both sensors

% Define the range of angles


theta = -pi:0.01:pi; % Full range from -180 to 180 degrees

% Initialize the radiation pattern


pattern = zeros(size(theta));

% Calculate the radiation pattern


for k = 1:length(theta)
% Steering vector for each angle
a = [1; exp(-1i*2*pi*d*sin(theta(k)))];
% Array factor for each angle
pattern(k) = abs(w'*a)^2;
end

% Normalize the radiation pattern


pattern_dB = 10*log10(pattern/max(pattern));

% Plot the radiation pattern


figure;
plot(theta*(180/pi), pattern_dB); % Convert radians to degrees for the x-
axis
title('Normalized Radiation Pattern for a Non-Weighted Two-Sensor Array');
xlabel('Angle (degrees)');
ylabel('Normalized Gain (dB)');
grid on;
axis([-180 180 -60 0]); % Set the x-axis from -180 to 180 and y-axis for
the gain

24 | P a g e
Normalized radiation pattern for a non-weighted two-sensor array

25 | P a g e
Z

26 | P a g e
27 | P a g e
1. Introduction
A device able to receive or transmit electromagnetic energy is called an
antenna. Antennas have become ubiquitous devices and occupy a salient
position in wireless system experienced the largest growth among
industry systems. Antennas couple electromagnetic energy from one
medium (space) to another medium as wire, coaxial cable, or waveguide.
Physical designs can vary greatly. Antenna produces complex
electromagnetic fields both near to and far from antennas. Not all of the
electromagnetic fields generated actually radiated into space. Some of the
fields remain in the vicinity of antenna and are viewed as reactive near
fields; much the same way as inductor or capacitor is a reactive storage
element in lumped element circuits.

Smart Antenna

The concept of using multiple antennas and innovative signal processing


to serve cells more intelligently has existed for many years. In fact,
varying degrees of relatively costly smart antenna systems have already
been applied in defence systems. Until recent years, cost barriers have
prevented their use in commercial systems .The advent of powerful, low-
cost digital signal processors (DSPs), general-purpose processors (and
ASICs), as well as innovative software-based signal-processing
techniques (algorithms) have made intelligent antennas practical for
cellular communications systems. Smart antenna systems are the
technology of uniting not only antenna technology but also two or more
of other technology as digital signal processors and high function of
antennas. Today, when spectrally efficient solutions are increasingly a
business imperative, these systems are providing greater coverage area
for each cell site, higher rejection of interference, and substantial capacity
improvements. That can overcome the problem in high speed mobile
communication such as limited channel bandwidth while satisfying the
demand for many mobiles in a limited channel. In truth, antennas are not
smart, antenna systems are smart. Generally co-located with a base
station, a smart antenna system combines an antenna array with a digital
signal-processing capability to transmit and receive in an adaptive,
spatially sensitive manner. In other words, such a system can
automatically change the directionality of its radiation patterns in
response to its signal environment. Smart antennas also known as
adaptive array antennas, multiple antennas and recently MIMO that are
antenna arrays with smart signal processing algorithms used to identify
spatial signal signature such as the direction of arrival of the signal, and
use it to calculate beamforming vectors, to track and locate the antenna
28 | P a g e
beam on the mobile/target. The antenna could optionally be any sensor.
This can dramatically increase the performance characteristics (such as
capacity) of a wireless system.

ULA - Algorithm:
We can explain the functioning principle of a “smart” antenna using a
simple example. In the example, we consider a uniform linear array
(ULA) consisting of two identical Omni-directional sensors as shown in
Figure 1 .We assume that a signal is generated by a source in the far-
field of the “smart” antenna. The impinging signal on the sensor array is
approximately a uniform plane wave, as shown in Figure 1. With respect
to sensor 1, sensor 2 experiences a time delay of

(2)
Where d is the spacing between the two elements and the wave speed.
Similarly, knowing d and measuring , the angle of the direction of
arrival is found using
(3)
If is a narrowband signal with carrier frequency , then the time delay
corresponds to a phase shift of

(4)
Where is the wavelength corresponding to the carrier frequency, i.e.
. Clearly, for an incoming signal from a direction perpendicular to the array
normal , both the time delay and phase shift between the two sensors
are zero.

Figure 1: Uniform Linear Array (ULA)

29 | P a g e
Figure 2

Figure 2: Normalized radiation pattern for a non weighted two-sensor


array. Figure 2 shows the normalized radiation pattern for a two
element antenna array.

13. normalized radiation pattern


The normalized radiation pattern of an N-element ULA of
omnidirectional elements with inter-element spacing d is given in dB by

where w is the N-dimensional vector consisting of the complex weights of the


antenna elements.

30 | P a g e
14. Flowchart
14.1. 3.1 Flowchart of Normalized radiation pattern for a
weighted two-sensor array.
1. Initialize Parameters:
- Define `N` as the number of elements in the array, which is 2 in this
case.
- Set `d` as the spacing between the elements in wavelengths, which is
0.5 wavelengths.
2. Define the Weights:
- Assign complex weights to the array elements:
- `w1` is set to (0.5 times (1 - i)) for the first sensor.
- `w2` is set to (0.5 times (1 + i)) for the second sensor.
- Combine these weights into a vector `w` = ([w1; w2]).
3. Define the Range of Angles:
- Set `theta`, an array representing the range of angles from (-pi) to (pi)
(or -180 degrees to 180 degrees), with an increment of 0.01 radians.
This covers a full 360-degree span.
4. Initialize the Radiation Pattern:
- Create an array `pattern` initialized to zero, with the same size as
`theta`. This array will store the calculated radiation pattern values.
5. Calculate the Radiation Pattern:
- Loop through each angle `k` in `theta`:
- Calculate the steering vector `a` for the current angle `theta(k)`. This
vector accounts for the phase difference caused by the geometry and
element spacing.
- Compute the array factor for the current angle This formula calculates
the power of the signal received from the direction specified by
`theta(k)`.
- Store the computed array factor in `pattern(k)`.
6. Normalize the Radiation Pattern:

31 | P a g e
- Convert `pattern` into decibels (dB) relative to its maximum value.
This is done by dividing the entire `pattern` by its maximum value to
normalize it, then converting this normalized pattern to dB.

7. Plot the Radiation Pattern:


- Plot `pattern_dB` against `theta` converted to degrees on the x-axis.
- Set the plot title to 'Normalized Radiation Pattern for a Non-Weighted
Two-Sensor Array'.
8. End of Algorithm

32 | P a g e
15. THE MATLAB CODE

15.1. 4.1 MATLAB code of Normalized radiation pattern for


a weighted two-sensor array.
% Define the number of elements and the spacing between them
N = 2; % Number of elements in the array
d = 0.5; % Spacing between elements in wavelengths

% Define the weights for the array elements as given in the document
w1 = 0.5 * (1 - 1i); % Weight for the first sensor
w2 = 0.5 * (1 + 1i); % Weight for the second sensor
w = [w1; w2]; % Weight vector

% Define the range of angles


theta = -pi:0.01:pi; % Full range from -180 to 180 degrees

% Initialize the radiation pattern


pattern = zeros(size(theta));

% Calculate the radiation pattern


for k = 1:length(theta)
% Steering vector for each angle
a = [1; exp(-1i*2*pi*d*sin(theta(k)))];
% Array factor for each angle
pattern(k) = abs(w'*a)^2;
end

% Normalize the radiation pattern


pattern_dB = 10*log10(pattern/max(pattern));

% Plot the radiation pattern


figure;
plot(theta*(180/pi), pattern_dB); % Convert radians to degrees for the x-
axis
title('Normalized Radiation Pattern for a Weighted Two-Sensor Array');
xlabel('Angle (degrees)');
ylabel('Normalized Gain (dB)');
grid on;
axis([-180 180 -30 0]); % Set the x-axis from -180 to 180 and y-axis for
the gain

33 | P a g e
34 | P a g e
Normalized radiation pattern for a weighted five-sensor array.
Pattern forming network, and the adaptive processor

Done By:
ZAKARYA SADEQ 202170091
Supervisor By:
D. MOHAMMED AL-SURABI
Table of Contents

Table of Contents 1
1. Introduction 2
2. normalized radiation pattern 4
3. Flowchart 5
3.1 Flowchart of Normalized radiation pattern for a weighted five-sensor
array. 5
4. THE MATLAB CODE 7
35 | P a g e
4.1 MATLAB code of Normalized radiation pattern for a weighted five-
sensor array. 7

1. Introduction
A device able to receive or transmit electromagnetic energy is called an
antenna. Antennas have become ubiquitous devices and occupy a salient
position in wireless system experienced the largest growth among industry
systems. Antennas couple electromagnetic energy from one medium
(space) to another medium as wire, coaxial cable, or waveguide. Physical
designs can vary greatly. Antenna produces complex electromagnetic fields
both near to and far from antennas. Not all of the electromagnetic fields
generated actually radiated into space. Some of the fields remain in the
vicinity of antenna and are viewed as reactive near fields; much the same
way as inductor or capacitor is a reactive storage element in lumped
element circuits.
Smart Antenna
The concept of using multiple antennas and innovative signal processing
to serve cells more intelligently has existed for many years. In fact, varying
degrees of relatively costly smart antenna systems have already been
applied in defence systems. Until recent years, cost barriers have prevented
their use in commercial systems .The advent of powerful, low-cost digital
signal processors (DSPs), general-purpose processors (and ASICs), as well
as innovative software-based signal-processing techniques (algorithms)
have made intelligent antennas practical for cellular communications
systems. Smart antenna systems are the technology of uniting not only
antenna technology but also two or more of other technology as digital
signal processors and high function of antennas. Today, when spectrally
efficient solutions are increasingly a business imperative, these systems are
providing greater coverage area for each cell site, higher rejection of
interference, and substantial capacity improvements. That can overcome
the problem in high speed mobile communication such as limited channel
bandwidth while satisfying the demand for many mobiles in a limited
channel. In truth, antennas are not smart, antenna systems are smart.
Generally co-located with a base station, a smart antenna system combines
an antenna array with a digital signal-processing capability to transmit and
receive in an adaptive, spatially sensitive manner. In other words, such a
36 | P a g e
system can automatically change the directionality of its radiation patterns
in response to its signal environment. Smart antennas also known as
adaptive array antennas, multiple antennas and recently MIMO that are
antenna arrays with smart signal processing algorithms used to identify
spatial signal signature such as the direction of arrival of the signal, and
use it to calculate beamforming vectors, to track and locate the antenna
beam on the mobile/target. The antenna could optionally be any sensor.
This can dramatically increase the performance characteristics (such as
capacity) of a wireless system.
ULA - Algorithm:
We can explain the functioning principle of a “smart” antenna using a
simple example. In the example, we consider a uniform linear array (ULA)
consisting of two identical Omni-directional sensors as shown in Figure 1
.We assume that a signal is generated by a source in the far-field of the
“smart” antenna. The impinging signal on the sensor array is approximately
a uniform plane wave, as shown in Figure 1. With respect to sensor 1,
sensor 2 experiences a time delay of

(2)
Where d is the spacing between the two elements and the wave speed.
Similarly, knowing d and measuring , the angle of the direction of arrival
is found using
(3)
If is a narrowband signal with carrier frequency , then the time delay
corresponds to a phase shift of

(4)
Where is the wavelength corresponding to the carrier frequency, i.e. .
Clearly, for an incoming signal from a direction perpendicular to the array
normal , both the time delay and phase shift between the two sensors are
zero.

Figure 1: Uniform Linear Array (ULA)

37 | P a g e
Figure 2
Figure 2: Normalized radiation pattern for a non weighted two-sensor
array. Figure 2 shows the normalized radiation pattern for a two element
antenna array.

2. normalized radiation pattern


The normalized radiation pattern of an N-element ULA of
omnidirectional elements with inter-element spacing d is given in dB by

where w is the N-dimensional vector consisting of the complex weights of


the antenna elements.

3. Flowchart
3.1 Flowchart of Normalized radiation pattern for a weighted five-sensor
array.
1. Initialize Parameters:
- Define `N` as the number of elements in the array, which is 5 in this
case.
- Set `d` as the spacing between the elements in wavelengths, which
is 0.5 wavelengths.
2. Set Steering and Interfering Angles:

38 | P a g e
- Define `theta_s`, the steering angle for the desired signal direction,
which is set to 0 degrees.
- Set `theta_i`, an array of angles in degrees for interfering signals,
with values at [-75, -45, 30, 60].
4. Compute Direction Vectors:
- Calculate the direction vector `a_s` for the desired signal based on
the steering angle `theta_s`.
- Initialize a matrix `a_i` to store direction vectors for each of the
interfering angles `theta_i`.
- Loop through each interfering angle and compute the respective
direction vectors, storing them in `a_i`.
5. Define Array Weights:
- Initialize the weights vector `w` with uniform values assuming equal
contribution from all array elements. In practice, these weights may be
optimized based on specific array processing techniques.
6. Calculate Normalized Radiation Pattern:
- Define a range of angles `theta` from -180 to 180 degrees to evaluate
the radiation pattern.
- Initialize the array factor `AF` to store the radiation pattern values.
- Loop through each angle in `theta`:
- Compute the direction vector `a_theta` for the current angle.
- Calculate the array factor `AF` at this angle using the formula
|w'*a_theta|^2, which involves the conjugate transpose of `w` and the
direction vector `a_theta`.
- Normalize the array factor by converting it into decibels relative to
its maximum value using 10*log10(AF/max(AF)).
7. Plot the Radiation Pattern:
- Plot the array factor in dB against the angle vector `theta`.
- Set the plot title, axis labels, and grid. Configure the axis range to
focus on the critical areas of the plot.
8. End of Algorithm

39 | P a g e
This algorithm provides a comprehensive outline of how to simulate an
antenna array's directional characteristics, taking into account both desired
and interfering signals, highlighting the computational steps from
initialization to visualization.
4. THE MATLAB CODE
4.1 MATLAB code of Normalized radiation pattern for a weighted five-
sensor array.
clear
% Number of elements in the array
N = 5;

% Wavelength (lambda)
lambda = 1; % Assuming a normalized wavelength

% Interelement spacing (d)


d = lambda / 2;

% Steering angle (theta_s)


theta_s = 0; % in degrees

% Interfering angles (theta_i)


theta_i = [-75, -45, 30, 60]; % in degrees

% Desired signal direction vector


a_s = exp(-1i*2*pi*d*sin(deg2rad(theta_s))/lambda*(0:N-1)');

% Interferer direction vectors


a_i = zeros(4, length(theta_i));
for k = 1:length(theta_i)

40 | P a g e
a_i(:,k) = exp(-1i*2*pi*d*sin(deg2rad(theta_i(k)))/lambda*(0:N-2)');
end

% Weights (assuming they are given or calculated previously)


% Replace with actual weights
w=[1;1;1;1;1]

% Normalized radiation pattern calculation


theta = -180:1:180; % Angle vector
AF = zeros(size(theta));
for t = 1:length(theta)
a_theta = exp(-1i*2*pi*d*sin(deg2rad(theta(t)))/lambda*(0:N-1)');
AF(t) = abs(w'*a_theta)^2;
end
AF_dB = 10*log10(AF/max(AF)); % Convert to dB

% Plotting the radiation pattern


figure;
plot(theta, AF_dB);
title('Normalized Radiation Pattern for a Weighted Five-Sensor Array');
xlabel('Angle (degrees)');
ylabel('Gain (dB)');
grid on;
axis([-180 180 -30 0]);

41 | P a g e
The MUSIC Algorithm
Multiple Signal Classification

Done By:
ZAKARYA SADEQ 202170091
Supervisor By:
D. MOHAMMED AL-SURABI
Table of Contents
Table of Contents 1
1. Introduction 2
2. Laws and equations 4
3. Flowchart 5
4. THE MATLAB CODE 6

42 | P a g e
1. Introduction
This repository presents a mini project to show how the direction of arrivals
(DOA) is estimated using the MUSIC algorithm. MUSIC stands for
MUltiple SIgnal Classification. It is a subspace-based algorithm used for
estimating the DOA of same-frequency narrowband sources arriving at a
sensor array. MUSIC outperforms simple methods such as picking peaks
of DFT (Discrete Fourier Transform) spectra in the presence of noise when
the number of components is known in advance because it exploits
knowledge of this number to ignore the noise in its final report.
MUSIC is a spatial spectrum estimation algorithm based on second order
statistics. It attracted intensive studies due to the following perceived
advantages.
• Capability to handle multiple simultaneous sources
• High precision measurement
• High spatial resolution
• Adjustable to small observable data cases
• Possible for real time implementation.
This short explanation the basic idea and implementation are described. Its
use for resolving multiple sound sources with antenna array is discussed.
Generalizing Figure 1 to N sources to M microphones, we have the
microphone captured sound vector,

We can further write this into the following matrix form,

where , , and
.
The covariance matrix, , is Hermitian and positive definite since is always
positive definite.

43 | P a g e
By eigenvalue decomposition, and are the eigenvector and corresponding
eigenvalue, we have

The noise dimension has smaller eigenvalue, which is the noise floor, while
the dimensions that contain signals will have larger eigenvalue. Therefore,
the noise subspace can be constructed by
.
The signal dimension will have smaller value if it is projected into the noise
subspace. Therefore, the following formula will have larger value and
appear to be a peak,

Figure 2
The above formula defines the MUSIC algorithm. The number of peaks
indicates the number of independent sound sources and the corresponding
direction defines the incoming direction of each sound source.
Figure 2 shows results of MUSIC algorithm for a linear array of 8
microphones. The three incoming signals impinge on the array at 0, 30, and
60 degrees from the broadside.
2. Laws and equations
Once the subspaces are determined, the DOAs of the desired signals can
be estimated by calculating the MUSIC spatial spectrum over the region of
interest

the a(θ)s are the array response vectors calculated for all angles θ within
the range of interest. Because the desired array response vectors A () are
orthogonal to the noise subspace, the peaks in the MUSIC spatial spectrum
represent the DOA estimates for the desired signals. Due to imperfections
in deriving Rxx, the noise subspace eigenvalues will not be exactly equal
to σ2 n . They do, however, form a group around the value σn2 and can be
distinguished from the signal subspace eigenvalues. The separation
becomes more pronounced as the number of samples used in the estimation
of Rxx increases (ideally reaches infinity).

44 | P a g e
16.

17. 3. Flowchart
This is the flowchart to guide the MATLAB code for calculating a
plotting the bit error probability for BPSK modulation over AWGN a
Rayleigh fading channels:

1. Initialize the Environment:


- Clear previous MATLAB workspace with `clear` command to
ensure no variables carry over from prior sessions.

2. Create Uniform Linear Array (ULA):


- Initialize a ULA with 8 elements and a spacing of 0.5 wavelengths
using the `phased.ULA` function.

3. Define Signal Angles:


- Define angles of arrival for multiple signals as azimuth angles; in
this case:
- First signal from 60 degrees,

45 | P a g e
- Second signal from 15 degrees,
- Third signal from -30 degrees,
- Fourth signal from -75 degrees.
- Store these angles in a matrix `angs`.

4. Setup Physical Constants and Signal Properties:


- Use `physconst` to get the speed of light.
- Set the operating frequency `fc` to 300 MHz.
- Calculate the wavelength `lambda` using the speed of light and
frequency.

5. Compute Element Positions:


- Calculate the positions of array elements normalized by the
wavelength using `getElementPosition` from the `ula` object.

6. Compute Covariance Matrix:


- Calculate the sensor covariance matrix for the given element
positions and signal angles using `sensorcov`. This matrix is essential for
spatial spectrum methods like MUSIC.

7. Apply MUSIC Algorithm:


- Use the MUSIC algorithm to estimate directions of arrival (DOAs)
of the incoming signals. This involves:
- Feeding the covariance matrix into `musicdoa` function.
- Specifying the number of signals to estimate, which is 4 in this case.
8. Plot the MUSIC Spectrum:
- Plot the MUSIC spectrum which shows peaks at the estimated DOA
angles.
- Use decibels for the y-axis to represent the spectrum's power,
improving visibility of results.

46 | P a g e
- Label the axes and add a title to the plot.
- Enable the grid for better readability of the plot.

End of Algorithm
This algorithm provides an overview of setting up a ULA for DOA
estimation, computing the necessary covariance matrix, applying the
MUSIC algorithm, and visualizing the results. Each step is crucial for
understanding how the DOA estimations are derived from the given signals
and their directions.

4. THE MATLAB CODE


clear
ula = phased.ULA('NumElements',8,'ElementSpacing',0.5);
ang1 = [60; 0]; % First signal
ang2 = [15; 0]; % Second signal
ang3 = [-30; 0];
ang4 = [-75; 0];

47 | P a g e
18. Introduction
Conventional beamforming, also called classical beamforming, is the
easiest to understand. Conventional beamforming techniques include
delay-and-sum beamforming, phase-shift beamforming, subband
beamforming, and filter-and-sum beamforming. These beamformers are
similar because the weights and parameters that define the beampattern are
fixed and do not depend on the array input data. The weights are chosen to
produce a specified array response to the signals and interference in the
environment. A signal arriving at an array has different times of arrival at
each sensor. For example, plane waves arriving at a linear array have a time
delay that is a linear function of distance along the array. Delay-and-sum
beamforming compensates for these delays by applying a reverse delay to
each sensor. If the time delay is accurately computed, the signals from each
sensor add constructively.
Finding the compensating delay at each sensor requires accurate
knowledge of the sensor locations and signal direction. The delay-and-
sum beamformer can be implemented in the frequency domain or in the
time domain. When the signal is narrowband, time delay becomes a phase
shift in the frequency domain and is implement by multiplying each
sensor signal by a frequency-dependent compensatory phase shift. This
algorithm is implemented in the phased.PhaseShiftBeamformer. For
broadband signals, there are several approaches. One approach is to delay
the signal in time by a discrete number of samples. A problem with this
method is that the degree of resolution that you can distinguish is
determined by the sampling rate of your data, because you cannot resolve
delay differences less than the sampling interval. Because this technique
only works if the sampling rate is high, you must increase the sampling
frequency well beyond the Nyquist frequency so that the true delay is
very close to a sample time. A second method interpolates the signal
between samples. Time delay beamforming is implemented in
phased.TimeDelayBeamformer. A third method Fourier transforms the
signals to the frequency domain, applies a linear phase shift, and converts
the signal back into the time domain. Phase-shift beamforming is
performed at each frequency band Beamforming is not limited to plane
waves but can be applied even when there is wavefront curvature. In this
case, the source lies in the near field. Perhaps the term beamforming is no

48 | P a g e
longer appropriate. You can use the source-array geometry to compute the
phase shift for each point in space and then apply this phase shift at each
sensor element.
The advantage of a conventional beamformer is simplicity and ease of
implementation. Another advantage is its robustness against pointing errors
and signal direction errors. A disadvantage is its broad main lobe which
decreases resolution of closely spaced sources or targets. A second
disadvantage is that it has large sidelobes that allow interference sources to
leak into the main beam.

49 | P a g e
19. Laws and equations
Once the beamforming weight vector w is calculated, the response of this
spatial filter is represented by the antenna radiation pattern (beampattern)
for all directions, which is expressed as

P(θ) represents the average power of the spatial filter output when a single,
unitypower signal arrives from angle θ . With proper control of the magnitude and
phase in w, the pattern will exhibit a main beam in the direction of the desired
signal and, ideally, nulls toward the direction of the interfering signals.
In classical beamforming, the beamforming weight is set to be equal to the array
response vector of the desired signal. For any particular direction θ0, the antenna
pattern formed using the weight vector wb = a(θ0) has the maximum gain in this
direction compared to any other possible weight vector of the same magnitude.
This is accomplished because wb adjusts the phases of the incoming signals
arriving at each antenna element from a given direction θ0 so that they add in-
phase (or constructively). Because all the elements of the beamforming weight
vector are basically phase shifts with unity magnitude, the system is commonly
referred to as phased array. Mathematically, the desired response of the method
can be justified by the Cauchy–Schwartz inequality

for all vectors w, with equality holding if and only if w is proportional to a(θ0)

50 | P a g e
20. Flowchart
1. Initialization:
- Clear all previous MATLAB data and variables.
- Define system parameters including the number of sensors `M`,
spacing between sensors `spacing`, number of jammers `numjam`,
and the signal power levels in decibels.

2. Configuration:
- Calculate angles for the signal of interest and jammers in radians.
- Combine these angles into a single vector `angle`.

3. Steering Vector Generation:


- Generate steering vectors for each jammer based on their respective
angles using a phased array formula.
- Compute the steering vector for the signal of interest in the same
manner.

4. Covariance Matrices:
- Compute the interference covariance matrix `Rint` from the steering
vectors of the jammers and their respective power levels.
- Calculate the total covariance matrix `Rnoise` by adding the identity
matrix (representing white noise) to `Rint`.

5. Generate Full Range Steering Vectors:


- Generate steering vectors for a full 360-degree range, in 0.5-degree
increments, for subsequent beamforming analysis.

6. Conventional Beamforming:
- Calculate the gain of the conventional beamformer across the 360-
degree range using the dot product of the steering vectors and the
vector for the signal of interest.

51 | P a g e
7. Optimal Wiener Filter Solution:
- Compute the Wiener filter weights by solving the Wiener-Hopf
equation using the total noise and interference covariance matrix and
the steering vector for the signal of interest.
- Calculate the gain of this optimal solution across the 360-degree range
in a similar manner to the conventional beamforming.
8. Plotting:
- Plot the frequency responses of both the conventional beamformer
and the Wiener solution to compare their performances.
- Mark the directions of the signal of interest and the jammers on the
plot for visual reference.
- Configure the plot with appropriate labels, legends, and axis limits.

End of Algorithm

This algorithm effectively outlines how to implement a beamforming simulation in MATLAB,


considering both conventional and optimal solutions, and how to visualize and compare
their performance against interference and noise.

52 | P a g e
53 | P a g e
21. THE MATLAB CODE
clear all
M = 6; % number of sensors
spacing = 1; % corresponds to lambda/2
numjam = 2; % number of jammers
numsigs = numjam + 1; % and one signal of interest
a = sqrt(0.5);
deg = pi/180; % degrees to radians conversions
angled = 30*deg; % desired signal angle-of-arrival (AoA); 0 assumes signal
comes from broadside
anglej = [-45 0]*deg; % jammer angles converted to radians
angle = [angled anglej]; % vector of all AoAs
sigpow = -10; % signal power [in dB]
jampow = [30 32 ]; % jammer powers [in dB]
% Generate steering vectors for each jammer
for p = 1:numjam
S(:,p) = exp(j*([0:M-1]'-(M-1)/2)*pi*spacing*sin(anglej(p)));
end
% Compute interference covariance matrix, i.e. jammers only
Rint = S*a*diag(10.^(jampow/10))*S';
% Compute total noise + interference covariance matrix
Rnoise = Rint + eye(M);

% Compute steering vector for signal-of-interest (SoI)


s = exp(j*([0:M-1]'-(M-1)/2)*pi*spacing*sin(angled));
s = s/sqrt(s'*s);
% Generate steering vectors
for m = 0:M-1
steer(m+1,:) = exp(j*(m-(M-1)/2)*pi*spacing*sin(([1:0.5:360]-
180)*deg));
end
% Compute and plot frequency response of conventional beamformer
for p = 1:(360/0.5-1)
gainc(p) = s'*steer(:,p)*steer(:,p)'*s;
end
% Compute optimum Wiener solution and plot its frequency response(mvdl)
w = inv(Rnoise)*s/(s'*inv(Rnoise)*s);
for p = 1:(360/0.5-1)
gain(p) = w'*steer(:,p)*steer(:,p)'*w;
end
% Plot resulting frequency responses to compare
figure;
% Conventional Beamformer
plot([1:0.5:360]-180, 10*log10(abs(gainc)), 'm', 'LineWidth', 1);
hold on;
% Optimal Wiener Solution
plot([1:0.5:360]-180, 10*log10(abs(gain)), 'b', 'LineWidth', 1);
% SoI Vertical Line
plot(angled/deg*ones(1,101), -60:40, 'g-', 'LineWidth', 1);
% SNOI Vertical Lines
for k = 1:numjam
plot(anglej(k)/deg*ones(1,101), -60:40, 'r-', 'LineWidth', 1);

54 | P a g e
end

legend('Conventional Beamformer', 'Optimal Wiener Solution', 'SoI',


'SNOI');
axis([-90 90 -60 40]);
xlabel('DoA [Degrees]');
ylabel('Beampatteren [dB]');
hold off;

Commented [EZ1]:
Commented [EZ2]:
Commented [EZ3R2]:
Commented [EZ4R2]:
Commented [EZ5]:
Commented [EZ6R5]:

55 | P a g e

You might also like