MATLAB Examples

# Example 11.5.2.b - Effect of the Number of Training Samples on the Sidelobes of the SMI Beamformer.

We want to explore the effect of the number of training samples on the sidelobe levels of the SMI adaptive beamformer. To this purpose, we generate an interference signal at with a power of 70 dB and thermal noise with unit variance for a ULA with M = 40 elements.

Copyright 2016-2026, Ilias S. Konsoulas.


## Workspace initialization.

clc; clear; close all; 

## Signal Definitions.

M = 40; % Number of Array Elements. K1 = 100; % Number of Signal Snapshots for Test case #1. K2 = 500; % Number of Signal Snapshots for Test case #2. K3 = 1000; % Number of Signal Snapshots for Test case #3. K4 = 10000; % Number of Signal Snapshots for Test case #4. lambda = 1; % Incoming Signal Wavelength in (m). d = lambda/2; % Interelement Distance in (m). SNR = 20; % target SNR in dBs phi_s = 0; % target azimuth angle in degrees phi_i = 10; % interference angle in degrees INR = 70; % Interference #1 INR in dBs u_s = (d/lambda)*sin(phi_s*pi/180); % Target Normalized Spatial Frequency. u_i = (d/lambda)*sin(phi_i*pi/180); % Interferer Normalized Spatial Frequency. v_s = exp(-1i*2*pi*u_s*(0:M-1).')/sqrt(M); % Target Steering Vector. v_i = exp(-1i*2*pi*u_i*(0:M-1).')/sqrt(M); % Interference Steering Vector. 

## Calculation of the true Interference-plus-Noise Autocorrelation Matrix.

R_ipn = 10^(INR/10)*(v_i*v_i') + eye(M); 

## Calculation of the Optimum Beamformer for a phi_s = 0 deg.

InvR = inv(R_ipn); %#ok<*MINV> % copt = InvR*v_s/(v_s'*InvR*v_s); 

## Monte-Carlo Repetitions Setup.

Run the experiment for 100 times (Monte-Carlo runs) and average over the results to get the correct curves of Fig. 11.23.

csmi1 = zeros(M,1); csmi2 = zeros(M,1); csmi3 = zeros(M,1); csmi4 = zeros(M,1); MC_Runs = 40; NSamples = 1e3; angle = -10:100/NSamples:90-60/NSamples; % Opt_Beam_Pat = zeros(Experiment_Repetitions,NSamples); SMI_Beam_Pat1 = zeros(MC_Runs,NSamples); SMI_Beam_Pat2 = zeros(MC_Runs,NSamples); SMI_Beam_Pat3 = zeros(MC_Runs,NSamples); SMI_Beam_Pat4 = zeros(MC_Runs,NSamples); 

## Monte-Carlo Runs.

Run the experiment many times and and average over the calculated SMI Beampatterns.

for k=1:MC_Runs % Uncorrelated unit power thermal noise samples drawn form a Gaussian distribution: w1 = (randn(M,K1) + 1i*randn(M,K1))/sqrt(2); w2 = (randn(M,K2) + 1i*randn(M,K2))/sqrt(2); w3 = (randn(M,K3) + 1i*randn(M,K3))/sqrt(2); w4 = (randn(M,K4) + 1i*randn(M,K4))/sqrt(2); % The interference (jammer) vector are generated by: i_x1=(10^(INR/20))*v_i*(randn(1,K1) + 1i*randn(1,K1))/sqrt(2); i_x2=(10^(INR/20))*v_i*(randn(1,K2) + 1i*randn(1,K2))/sqrt(2); i_x3=(10^(INR/20))*v_i*(randn(1,K3) + 1i*randn(1,K3))/sqrt(2); i_x4=(10^(INR/20))*v_i*(randn(1,K4) + 1i*randn(1,K4))/sqrt(2); % The interference-plus-noise signal x_i+n is generated by: iplusn1 = i_x1 + w1; iplusn2 = i_x2 + w2; iplusn3 = i_x3 + w3; iplusn4 = i_x4 + w4; R1 = 1/K1*(iplusn1*iplusn1'); R2 = 1/K2*(iplusn2*iplusn2'); R3 = 1/K3*(iplusn3*iplusn3'); R4 = 1/K4*(iplusn4*iplusn4'); InvR1 = inv(R1); InvR2 = inv(R2); InvR3 = inv(R3); InvR4 = inv(R4); csmi1 = InvR1*v_s/(v_s'*InvR1*v_s); % SMI Beamformer computed for phi_s = 0 deg & K1 = 100 snapshots. csmi2 = InvR2*v_s/(v_s'*InvR2*v_s); % SMI Beamformer computed for phi_s = 0 deg & K2 = 1000 snapshots. csmi3 = InvR3*v_s/(v_s'*InvR3*v_s); % SMI Beamformer computed for phi_s = 0 deg & K3 = 5000 snapshots. csmi4 = InvR4*v_s/(v_s'*InvR4*v_s); % SMI Beamformer computed for phi_s = 0 deg & K4 = 10000 snapshots. for l=1:NSamples u = (d/lambda)*sin(angle(l)*pi/180); v = exp(-1i*2*pi*u*(0:M-1).')/sqrt(M); % Azimuth Scanning Steering Vector. SMI_Beam_Pat1(k,l) = csmi1'*v; SMI_Beam_Pat2(k,l) = csmi2'*v; SMI_Beam_Pat3(k,l) = csmi3'*v; SMI_Beam_Pat4(k,l) = csmi4'*v; end SMI_Beam_Pat1(k,:) = 10*log10(abs(SMI_Beam_Pat1(k,:)).^2); SMI_Beam_Pat2(k,:) = 10*log10(abs(SMI_Beam_Pat2(k,:)).^2); SMI_Beam_Pat3(k,:) = 10*log10(abs(SMI_Beam_Pat3(k,:)).^2); SMI_Beam_Pat4(k,:) = 10*log10(abs(SMI_Beam_Pat4(k,:)).^2); end % Average the calculated SMI Beampatterns: Ave_SMI_Beam_Pat1 = 1/MC_Runs*sum(SMI_Beam_Pat1); Ave_SMI_Beam_Pat2 = 1/MC_Runs*sum(SMI_Beam_Pat2); Ave_SMI_Beam_Pat3 = 1/MC_Runs*sum(SMI_Beam_Pat3); Ave_SMI_Beam_Pat4 = 1/MC_Runs*sum(SMI_Beam_Pat4); 

## Finaly compute the optimal beamformer:

Opt_Beam_Pat = zeros(NSamples,1); for l=1:NSamples u = (d/lambda)*sin(angle(l)*pi/180); v = exp(-1i*2*pi*u*(0:M-1).')/sqrt(M); % Azimuth Scanning Steering Vector. Opt_Beam_Pat(l) = copt'*v; end 

## Plot the Average Beampatterns and compare with the Optimum Beampattern.

figure('NumberTitle', 'off','Name','Figure 11.23','Position',[150 100 900 600]); subplot(2,2,1); plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r',angle,Ave_SMI_Beam_Pat1,'k','LineWidth',1.5); title('K = 100'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,2); plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r',angle,Ave_SMI_Beam_Pat2,'k','LineWidth',1.5) title('K = 500'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,3); plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r',angle,Ave_SMI_Beam_Pat3,'k','LineWidth',1.5) title('K = 1000'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,4); plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r',angle,Ave_SMI_Beam_Pat4,'k','LineWidth',1.5); title('K = 10000'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); tightfig; 

## Plot the whole Ensemble of the Beampatterns found during Monte Carlo Simulation.

and compare with the Optimum Beampattern.

figure('Position',[150 100 900 600]); subplot(2,2,1); plot(angle,SMI_Beam_Pat1,'k'); hold on; plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r','LineWidth',1.5); title('K = 100'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,2); plot(angle,SMI_Beam_Pat2,'k'); hold on; plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r','LineWidth',1.5); title('K = 500'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,3); plot(angle,SMI_Beam_Pat3,'k'); hold on; plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r','LineWidth',1.5); title('K = 1000'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); subplot(2,2,4); plot(angle,SMI_Beam_Pat4,'k'); hold on; plot(angle,10*log10(abs(Opt_Beam_Pat).^2),'r','LineWidth',1.5); title('K = 10000'); xlim([-10 90]); ylim([-50 5]); grid on; xlabel('Angle (deg)'); ylabel('Power (dB)'); tightfig;