aasp

12
  AASP HW 7 JASMEET SINGH MATRIKEL - 53046 Question 1 Part (a) %% Function to implement the standard ESPRIT algorithm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function mu = ESPRIT(X,d,M) %% Signal subspace estimation [U,S,V]= svd(X); Us = U(:,1:d); %% Selection matrices for the subarrays with maximum overlap J1 = [eye(M-1) zeros(M-1,1)]; %% Exchange matrix exch_mat = @(i)fliplr(eye(i)); J2 = exch_mat(M-1)*J 1*exch_mat(M); %% Solving the invariance equation epsi = pinv(J1*Us)*(J2* Us); %% Estimation of the values of mu and sort [U_epsi,D_e psi] = eig(epsi);  phi = diag(D_epsi);  phi = phi(1:d); mu = sort(imag(log(phi)), 'ascend' ); Part (b) %% Checking the estimation accuracy of t he ESPRIT function defined in Part (a) clear all; clc all; M = 12;  N = 100; d = 4; rho = 0; mu = [-0.5; -0.3; 0.1; 0.2]; SNR1 = 10; % initial value of SNR in dB SNR2 = 50; % increased value of SNR in dB SNR3 = 100; % further increased value of SNR in dB X1 = GetArrayOutput(M,mu,SNR1,N,rho); % measurement matrix for SNRl X2 = GetArrayOutput(M,mu,SNR2,N,rho); % measurement matrix for SNR2 X3 = GetArrayOutput(M,mu,SNR3,N,rho); % measurement matrix for SNR3

description

aasp

Transcript of aasp

  • AASP HW 7

    JASMEET SINGH

    MATRIKEL - 53046

    Question 1

    Part (a)

    %% Function to implement the standard ESPRIT algorithm %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function mu = ESPRIT(X,d,M)

    %% Signal subspace estimation

    [U,S,V]= svd(X);

    Us = U(:,1:d);

    %% Selection matrices for the subarrays with maximum overlap

    J1 = [eye(M-1) zeros(M-1,1)];

    %% Exchange matrix

    exch_mat = @(i)fliplr(eye(i));

    J2 = exch_mat(M-1)*J1*exch_mat(M);

    %% Solving the invariance equation

    epsi = pinv(J1*Us)*(J2*Us);

    %% Estimation of the values of mu and sort

    [U_epsi,D_epsi] = eig(epsi);

    phi = diag(D_epsi);

    phi = phi(1:d);

    mu = sort(imag(log(phi)), 'ascend');

    Part (b)

    %% Checking the estimation accuracy of the ESPRIT function defined in Part (a) clear all;

    clc all;

    M = 12;

    N = 100;

    d = 4;

    rho = 0;

    mu = [-0.5; -0.3; 0.1; 0.2];

    SNR1 = 10; % initial value of SNR in dB

    SNR2 = 50; % increased value of SNR in dB

    SNR3 = 100; % further increased value of SNR in dB

    X1 = GetArrayOutput(M,mu,SNR1,N,rho); % measurement matrix for SNRl

    X2 = GetArrayOutput(M,mu,SNR2,N,rho); % measurement matrix for SNR2

    X3 = GetArrayOutput(M,mu,SNR3,N,rho); % measurement matrix for SNR3

  • mu1 = ESPRIT(X1,d,M); % estimate the spatial frequencies

    mu2 = ESPRIT(X2,d,M); % using the function ESPRIT for SNR1, SNR2 and SNR3

    mu3 = ESPRIT(X3,d,M);

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    Following are the outputs the estimates of the spatial frequency for different values of SNR.

    mu1 = mu2 = mu3 =

    -0.4772 -0.4997 0.5000

    -0.2669 -0.3002 -0.3000

    0.1687 0.0997 0.1000

    0.5342 0.2008 0.2000

    Comments:

    From the above results, we can see that, as the value of SNR increases the estimate improves and

    reaches the actual values when SNR tends to infinity (very high value). So it is confirmed that

    the ESPRIT function is working correctly as expected.

    Part (c) & Part (d)

    %% Computation of squared estimation error for the ESPRIT function for different SNRs, with

    %% and without FBA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    clear all;

    close all;

    clc;

    rho = [0 0.9 0.95 0.99];

    for k = 1:length(rho)

    M = 12; N = 100; d = 4; % use the same parameters as in task 2

    mu = [-0.5; -0.3; 0.1; 0.2];

    N_runs = 100; % number of times the estimation process is run

    SNR = linspace(0,50,20);

    muest = zeros(length(mu),length(SNR));

    muest_FBA = zeros(length(mu),length(SNR));

    e_est = zeros(length(SNR),1); % estimation error

    N_e = zeros(length(SNR),N_runs); % number of errors

    N_e_FBA = zeros(length(SNR),N_runs); % Forward-backward averaging number of erros

    for i = 1:length(SNR)

    for j = 1:N_runs

    X = GetArrayOutput(M,mu,SNR(i),N,rho(k)); % measurement matrix for different

    %% Values of SNR

    muest(:,i) = ESPRIT(X,d,M); % estimate the spatial frequencies

    e_est(i) = norm(mu(:)-muest(:,i))^2;

    N_e(i,j) = norm(mu(:)-muest(:,i))^2;

    %% Forward-bakward averaging

    exch_mat = @(i)fliplr(eye(i)); % exchange matrix

    Z = [X,exch_mat(M)*conj(X)*exch_mat(N)];

    muest_FBA(:,i) = ESPRIT(Z,d,M);

    N_e_FBA(i,j) = norm(mu(:)-muest_FBA(:,i))^2;

  • end

    end

    %% plot Figures

    figure(1000+k)

    semilogy(SNR,e_est,'linewidth',1.65)

    grid on

    xlabel('SNR (dB)');

    ylabel('Estimation error');

    title(['Squared estimation error for the ESPRIT algorithm with' ' ',num2str(rho(k)),' ' 'correlation']);

    figure(2000+k)

    semilogy(SNR,mean(N_e,2),'linewidth',1.65)

    hold on

    semilogy(SNR,mean(N_e_FBA,2),'.-g','linewidth',1.65)

    grid on

    xlabel('SNR (dB)');

    ylabel('Average squared estimation error');

    title(['Average squared estimation error for for the ESPRIT algorithm with ' ' ',num2str(rho(k)),' ' 'correlation']);

    legend('Without FBA','With FBA','Location','SouthEast');

    end

  • To lower the estimation error by one decade (factor 10), how much does the SNR have to

    be increased?

    From the figure we can say that, SNR should be increased to about 8 dB in order to lower the

    estimation error by one decade (factor of 10).

  • Question 2

    Part (d) close all;

    clear all;

    theta1=30;

    phy1=180;

    theta2=45;

    phy2=45;

    u1=pi*sin(theta1);

    u2=pi*sin(phy1);

    v1=pi*sin(theta2);

    v2=pi*sin(phy2);

    A= [1 1;

    exp(-1i*u1) exp(-1i*v1);

    exp(-1i*2*u1) exp(-1i*2*v1);

    exp(-1i*(u2+0)) exp(-1i*(v2+0));

    exp(-1i*(u2+u1)) exp(-1i*(v2+v1)) ;

    exp(-1i*(u2+2*u1)) exp(-1i*(v2+2*v1));

    exp(-1i*(2*u2+0)) exp(-1i*(2*v2+ 0));

    exp(-1i*(2*u2+u1)) exp(-1i*(2*v2+ v1));

    exp(-1i*(2*u2+2*u1)) exp(-1i*(2*v2+ 2*v1))];

    Q_9= (1/sqrt(2))* [1 0 0 0 0 1i 0 0 0; 0 1 0 0 0 0 1i 0 0; 0 0 1 0 0 0 0 1i 0; 0 0 0 1 0 0 0 0 1i; 0 0 0 0 sqrt(2) 0 0 0 0 ;

    0 0 0 1 0 0 0 0 -1i;

    0 0 1 0 0 0 0 -1i 0;

    0 1 0 0 0 0 -1i 0 0;

    1 0 0 0 0 -1i 0 0 0];

    Rss=eye(2);

    sigma_n=1;

    Rxx = A*Rss*A' + (sigma_n)^2* eye(9);

    Rxx_fb=(1/2)* ( Rxx + fliplr(eye(9))*conj(Rxx)*fliplr(eye(9)) );

    psy_Rxx_fb= Q_9'*Rxx_fb*Q_9;

    U=psy_Rxx_fb;

    Us=U(:,1:2) ; % dominant eigen vectors

    Output:

  • Part (e) close all;

    clear all;

    Q_6= (1/sqrt(2))* [1 0 0 1i 0 0; 0 1 0 0 1i 0; 0 0 1 0 0 1i; 0 0 1 0 0 -1i; 0 1 0 0 -1i 0; 1 0 0 -1i 0 0]; J_u2= [0 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 1]; J_v2= [1 0 0 0 0 0 0 0 0; 0 1 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 1 0]; k1 = Q_6'*J_u2*Q_9; k_u1= 2*real(k1); k_u2=2*imag(k1); k2= Q_6'*J_v2*Q_9; k_v1= 2*real(k2); k_v2=2*imag(k2);

    Output:

  • Part (f)

    Real Valued Invariance Equations are given as:

    T_u_tls = (k_u1*Es)'*k_u2*Es; T_v_tls = (k_v1*Es)'*k_v2*Es;

    Part (g)

    Es= Q_9'*Us; T_u_tls = (k_u1*Es)'*k_u2*Es; T_v_tls = (k_v1*Es)'*k_v2*Es;

    Output:

    Part (h) close all;

    clear all;

    eig_val = eig(T_u_tls +1i*T_v_tls); for i=1:2 u(i)=2*atan(real(eig_val(i))) end; for i=1:2 v(i)=2*atan(imag(eig_val(i))) end;

    Output:

    u = 1.8028 2.9910

    v = 1.8014 3.0992