How to separate the MIMO code only from given code?

4 views (last 30 days)
The given code treats three types of system namly PHASED-ARRAY RADAR, MIMO RADAR and PHASED-MIMO RADAR (K=5). I want to delete the two namely PHASED-ARRAY RADAR and PHASED-MIMO RADAR (K=5) and keep only the code of MIMO RADAR and run it to get only its plot. But how as I am confused in doing so. Can anybody help me in this regard?
% subarrays that can overlap
function [sinr_o] = phased_mimo_radar()
clear;clc;
M = 10; % Total number of transmitting antennas
M_r = 10; % Total number of receiving antennas
d_t = 0.5; % transmitter spacings in wavelength
theta_tar = 10*pi/180; % Direction of target is 10 degress to the broadside of the array
a_tar = exp(-j*d_t*2*pi*(0:M-1)'*sin(theta_tar)); % Uplink steering vector
b_tar = exp(-j*pi*(0:M_r-1)'*sin(theta_tar)); % Downlink steering vector; Tx and Rx are assumed to be close to each other
theta_intrf = [-30 -10]*pi/180; % Interference dirstions
a_intrf = exp(-j*d_t*2*pi * (0:M-1)'*sin(theta_intrf));% steering vectors of interference
b_intrf = exp(-j*pi * (0:M_r-1)'*sin(theta_intrf));
%
no_subarrays = [1 5 10]; % K = 1, 5, and 10 correspond to phased-array, phased-MIMO, and MIMO radars, respectively
P_noise = 1;
INR = 50;
P_intrf = 10^(INR/10);
SNR = -0:10:0;
L_snr = length(SNR);
sinr_o = zeros(L_snr,length(no_subarrays));
Tx_pattern_conv = []; % Transmit beampattern
Dx_pattern_conv = []; % Diversity beampattern
Rx_pattern_conv = []; % Overall beampattern
for ksub = 1:length(no_subarrays);
K_sub = no_subarrays(ksub);
M_sub = M - K_sub + 1 ; % Number of antennas in each subarray
W_u_conv = uplink_conventional_beamforming(a_tar, K_sub, M_sub);
% Computing Transmit and diversity beampatterns
Theta_grid = [linspace(-pi/2,pi/2,1801)];
Tx_grid = exp(-j*d_t*2*pi * (0:M-1)'*sin(Theta_grid));
kk = 1; % kk refers to the k-th subarray, i.e., kk=1,....,K. Note that the K subarrays are identical. So the transmit beampattern is identical for all of them.
Tx_pattern = abs(W_u_conv(:,kk)'*Tx_grid(kk:M_sub + kk-1,:)).^2;
Tx_pattern = 10*log10(Tx_pattern);Tx_pattern = Tx_pattern - max(Tx_pattern);
Tx_pattern_conv = [Tx_pattern_conv; Tx_pattern];
Dx_pattern = abs(a_tar(1:K_sub)'*Tx_grid(1:K_sub,:)).^2;
Dx_pattern = 10*log10(Dx_pattern);Dx_pattern = Dx_pattern - max(Dx_pattern);
Dx_pattern_conv = [Dx_pattern_conv; Dx_pattern];
% Compute virtual steering vectors of target/interference
[v_tar] = virtual_sv(theta_tar, M, d_t, M_r, M_sub, K_sub, W_u_conv);
[v_intrf] = virtual_sv(theta_intrf, M, d_t, M_r, M_sub, K_sub, W_u_conv);%required for optimal SINR_o
for snr = 1:L_snr, snr
P_tar = 10^(SNR(snr)/10);
%P_intrf = P_tar; % keeping target and interference at the same power level
% Compute signal model using conventional uplink beamforming
[R] = MIMO_radar_signal_model(K_sub, a_tar, a_intrf, b_tar, b_intrf, P_tar, P_intrf, W_u_conv);
w_d_conv = v_tar/(norm(v_tar)); % conventional downlink beamformer
% output SINR for conventional Tx/Rx phased-MIMO radar
SINR_conv(snr,ksub) = 10*log10((M/K_sub)*P_tar*(abs(w_d_conv'*(v_tar)))^2/real(w_d_conv'*((M/K_sub)*P_intrf*v_intrf*v_intrf'+ P_noise*eye(K_sub*M_r))*w_d_conv));
% MVDR beamformer
w_d_capon = Capon_down_beamforming(v_tar, R);
% Compute and plot overall Tx/Rx beampattern
w_d = w_d_conv; % Use this to plot overall beampattern for Example 1
w_d = w_d_capon; % uncomment this line to plot overall beampattern for Example 5 and 6
[V_grid] = virtual_sv(Theta_grid, M, d_t, M_r, M_sub, K_sub, W_u_conv);
Rx_pattern = [10*log10(abs(w_d'*V_grid).^2)];
Rx_pattern = Rx_pattern - max(Rx_pattern);
Rx_pattern_conv = [Rx_pattern_conv; Rx_pattern];
%
SINR_MVDR(snr,ksub) = 10*log10((M/K_sub)*P_tar*(abs(w_d_capon'*(v_tar)))^2/real(w_d_capon'*((M/K_sub)*P_intrf*v_intrf*v_intrf'+ P_noise*eye(K_sub*M_r))*w_d_capon));
% Optimal output SINR
R_intrf_noise = (M/K_sub)*P_intrf * v_intrf*v_intrf' + P_noise*eye(K_sub*M_r);
R_intrf_noise = inv(R_intrf_noise);
w_opt = (1/(v_tar' * R_intrf_noise * v_tar)) * R_intrf_noise * v_tar;
SINR_opt(snr,ksub) = 10*log10((M/K_sub)*P_tar*(abs(w_opt'*(v_tar)))^2/real(w_opt'*((M/K_sub)*P_intrf*v_intrf*v_intrf'+ P_noise*eye(K_sub*M_r))*w_opt));
end
end
%
Theta = Theta_grid;
plot(Theta*180/pi,1.0*Tx_pattern_conv(1,:),'m--',Theta*180/pi,1.0*Tx_pattern_conv(3,:),'r:',Theta*180/pi,Tx_pattern_conv(2,:),'b','linewidth',1),grid
axis([-90 90 -80 20]),xlabel('ANGLE (DEGREES)'),ylabel('|C(\theta)|^2 (dB)')
legend('PHASED-ARRAY RADAR','MIMO RADAR','PHASED-MIMO RADAR (K=5)')
% % %
figure
Theta = Theta_grid;
plot(Theta*180/pi,1.0*Dx_pattern_conv(1,:),'m--',Theta*180/pi,1.0*Dx_pattern_conv(3,:),'r:',Theta*180/pi,Dx_pattern_conv(2,:),'b','linewidth',1),grid
axis([-90 90 -80 20]),xlabel('ANGLE (DEGREES)'),ylabel('|D(\theta)|^2 (dB)')
legend('PHASED-ARRAY RADAR','MIMO RADAR','PHASED-MIMO RADAR (K=5)')
% % %
%Rx_pattern_conv = Tx_pattern_conv+Dx_pattern_conv;
figure
plot(Theta*180/pi,1.02*Rx_pattern_conv(1,:),'m--',Theta*180/pi,1.0*Rx_pattern_conv(3,:),'r:',Theta*180/pi,Rx_pattern_conv(2,:),'b','linewidth',1),grid
axis([-90 90 -120 30]),xlabel('ANGLE (DEGREES)'),ylabel('|G(\theta)|^2 (dB)')
legend('PHASED-ARRAY RADAR','MIMO RADAR','PHASED-MIMO RADAR (K=5)')
%--------------------------------------------------------------------------
% This function computes the orthogonal waveforms that are emitted by
% transmitter
%--------------------------------------------------------------------------
function [R] = MIMO_radar_signal_model(K_sub, a_tar, a_intrf, b_tar, b_intrf, P_tar, P_intrf, W_u)
M_t = length(a_tar);
M_r = length(b_tar);
M_sub = M_t - K_sub + 1;
L_intrf = length(a_intrf(1,:));
% ---------- Orthogonal waveforms ------
N = 400; % number of smaples within one radar pulse (fast-time)
phi = [];
for kk = 1:K_sub
phi = [phi; exp(j*2*pi*(kk/N)*(0:N-1))];
end
% compute signals reflect by targets (observed by receiver)
T = 200; % number of radar pulses (slow-time)
y = zeros(K_sub*M_r,T); % K_sub matched filter applied to each antenna output (y is of size K_sub*N \times T)
Beta_tar = sqrt(P_tar)* (randn(1,T)+1i*randn(1,T));
Beta_intrf = sqrt(P_intrf)* (randn(L_intrf,T)+1i*randn(L_intrf,T));
for tt = 1:T; % tt is the snapshot number
% compute signals observed at targets
x_tar = zeros(1,N);
x_intrf = zeros(L_intrf,N);
for kk = 1:K_sub
x_tar = x_tar + Beta_tar(tt)*(W_u(:,kk)'* a_tar(kk:M_sub + kk-1))* phi(kk,:);
for ii = 1:L_intrf
x_intrf(ii,:) = x_intrf(ii,:) + Beta_intrf(ii,tt)*(W_u(:,kk)'* a_intrf(kk:M_sub + kk-1,ii))*phi(kk,:);
end
Z = (randn(M_r,N)+1i*randn(M_r,N));
x1 = b_tar * x_tar;
x2 = b_intrf * x_intrf;
x = x2 + Z;
y((kk-1)*M_r+1:kk*M_r,tt) = (1/N)*x*conj(phi(kk,:).');
end
end
R = (1/T)*(y*y');
%--------------------------------------------------------------------------
% This function computes the virtual steering vectors
%--------------------------------------------------------------------------
function [v_sv] = virtual_sv(Theta, Mt, d_t, Mr, M_sub, no_subarrays, W_u);
Tx_sv = exp(-j*d_t*2*pi * (0:Mt-1)'*sin(Theta));
Rx_sv = exp(-j*pi * (0:Mr-1)'*sin(Theta)); % Actual receiving steering vectors
v_sv = [];
for kk = 1:no_subarrays
v_temp = [];
w_u = W_u(:,kk);
for jj = 1:length(Theta)
%abs(w_u'*a_intrf(i:M_sub + i-1, jj))
v_temp = [v_temp, (w_u'*Tx_sv(kk:M_sub + kk-1, jj))*Rx_sv(:,jj)];
end
v_sv = [v_sv; v_temp];
end
%--------------------------------------------------------------------------
% This function computes the the uplink beamforming matrix. The kth column
% respresents the beamforming weight vector of the kth subarray
%--------------------------------------------------------------------------
function [W_u] = uplink_conventional_beamforming(a_tar, K_sub, M_sub);
w_u = a_tar(1:M_sub); % Uplind weight vector
w_u = w_u/(norm(w_u));
W_u = kron(ones(1, K_sub), w_u);
%--------------------------------------------------------------------------
% This function computes the the downlink beamforming weight vector
% (virtual array) using capon method.
%--------------------------------------------------------------------------
function [w_d_capon] = Capon_down_beamforming(v_tar, R);
R_y = inv(R);
w_d_capon = (1/(v_tar' * R_y * v_tar)) * R_y * v_tar;

Answers (0)

Categories

Find more on Beamforming and Direction of Arrival Estimation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!