How can i add Elevation Degree to my Script?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dion Akmal
el 5 de Jul. de 2023
Respondida: Rahul
el 5 de Jul. de 2023
clc
clear all
format long %The data show that as long shaping scientific
doa=[30]/180*pi; %Direction of arrival
phi_1 = [30]/180*pi; %Azimuth Degree
theta_1 = [90]/180*pi; %Elevation Degree
N=200;%Snapshots
w=[pi/4]';%Frequency
M=3;%Number of array elements
P=length(w); %The number of signal
snr=20;%SNA
D=[1; cos(phi_1+pi/4)/sin(theta_1); sin(phi_1+pi/4)/sin(theta_1)]; %Steering vector of Single Crossed-Loop/Monopole
xx=10*rand(1,N)+1i*rand(1,N); %Simulate signal
x=D*xx;
%%
x=x+awgn(x,snr);%Insert Gaussian white noise
R=x*x'; %Data covarivance matrix
[N,V]=eig(R); %Find the eigenvalues and eigenvectors of R
NN=N(:,1:2); %Estimate noise subspace
theta=-180:0.5:180; %Peak search
phi = -180:0.5:180; %Peak Search
for ll=1:length(phi);
for ii=1:length(theta);
SS=zeros(1,3);
for jj = 0:M-1
if jj == 0
SS(1+jj) = 1; % Rumus untuk elemen pertama SS
elseif jj == 1
SS(1+jj) = cos((phi(ll)/180*pi)+pi/4)/sin(theta_1); % Rumus untuk elemen kedua SS
elseif jj == 2
SS(1+jj) = sin((phi(ll)/180*pi)+pi/4)/sin(theta_1); % Rumus untuk elemen ketiga SS
end
end
PP=SS*NN*NN'*SS';
Pmusic(ll)=abs(1/ PP);
end
end
Pmusic=10*log10(Pmusic/max(Pmusic)); %Spatial spectrum function
figure;
plot3(phi,theta,Pmusic,'-k')
xlabel('angle \phi/degree')
ylabel('angle \theta/degree')
zlabel('spectrum function P(\theta) /dB')
title('DOA estimation based on MUSIC algorithm ')
grid on
My Plot Show that the Elevation degree is not same with my theta_1
0 comentarios
Respuesta aceptada
Rahul
el 5 de Jul. de 2023
Hi Dion,
According to the description given by you, the below modeified code to your original code would give you elevation in your plot.
format long %The data show that as long shaping scientific
doa = [30]/180*pi; %Direction of arrival
phi_1 = [30]/180*pi; %Azimuth Degree
theta_1 = [90]/180*pi; %Elevation Degree
N = 200; %Snapshots
w = [pi/4]'; %Frequency
M = 3; %Number of array elements
P = length(w); %The number of signal
snr = 20; %SNA
D = [1; cos(phi_1+pi/4)/sin(theta_1); sin(phi_1+pi/4)/sin(theta_1)]; %Steering vector of Single Crossed-Loop/Monopole
xx = 10*rand(1,N) + 1i*rand(1,N); %Simulate signal
x = D*xx;
x = x + awgn(x, snr); %Insert Gaussian white noise
R = x*x'; %Data covariance matrix
[N,V] = eig(R); %Find the eigenvalues and eigenvectors of R
NN = N(:,1:2); %Estimate noise subspace
theta = -180:0.5:180; %Azimuth angles
phi = -180:0.5:180; %Elevation angles
Pmusic = zeros(length(phi), length(theta)); %Initialize Pmusic matrix
for ll = 1:length(phi)
for ii = 1:length(theta)
SS = zeros(1,3);
for jj = 0:M-1
if jj == 0
SS(1+jj) = 1; % Rumus untuk elemen pertama SS
elseif jj == 1
SS(1+jj) = cos((phi(ll)/180*pi)+pi/4)/sin(theta(ii)/180*pi); % Rumus untuk elemen kedua SS
elseif jj == 2
SS(1+jj) = sin((phi(ll)/180*pi)+pi/4)/sin(theta(ii)/180*pi); % Rumus untuk elemen ketiga SS
end
end
PP = SS*NN*NN'*SS';
Pmusic(ll, ii) = abs(1/PP);
end
end
Pmusic = 10*log10(Pmusic/max(Pmusic(:))); %Spatial spectrum function
figure;
surf(phi, theta, Pmusic', 'EdgeColor', 'none');
xlabel('angle \phi/degree');
ylabel('angle \theta/degree');
zlabel('spectrum function P(\theta) /dB');
title('DOA estimation based on MUSIC algorithm');
In the modified code, I have added the elevation angles (phi) and modified the loop to iterate over both azimuth (ll) and elevation (ii) angles. The Pmusic matrix is now a 2D matrix to store the spatial spectrum function for each combination of azimuth and elevation angles.
Thanks.
0 comentarios
Más respuestas (1)
Gandham Heamanth
el 5 de Jul. de 2023
Editada: Gandham Heamanth
el 5 de Jul. de 2023
hi dion Akmal please have a look after updating the code:
clc
clear all
format long % The data show that as long shaping scientific
doa = [30]/180*pi; % Direction of arrival
phi_1 = [30]/180*pi; % Azimuth Degree
theta_1 = [90]/180*pi; % Elevation Degree
N = 200; % Snapshots
w = [pi/4]'; % Frequency
M = 3; % Number of array elements
P = length(w); % The number of signals
snr = 20; % SNR
D = [1; cos(phi_1+pi/4)/sin(theta_1); sin(phi_1+pi/4)/sin(theta_1)]; % Steering vector of Single Crossed-Loop/Monopole
xx = 10*rand(1,N)+1i*rand(1,N); % Simulate signal
x = D*xx;
x = x + awgn(x,snr); % Insert Gaussian white noise
R = x*x'; % Data covariance matrix
[N,V] = eig(R); % Find the eigenvalues and eigenvectors of R
NN = N(:,1:2); % Estimate noise subspace
theta_range = -180:0.5:180; % Peak search
phi_range = -180:0.5:180; % Peak search
Pmusic = zeros(length(phi_range), length(theta_range)); % Spatial spectrum function
for ll = 1:length(phi_range)
for ii = 1:length(theta_range)
SS = zeros(1,3);
for jj = 0:M-1
if jj == 0
SS(1+jj) = 1; % Rumus untuk elemen pertama SS
elseif jj == 1
SS(1+jj) = cos((phi_range(ll)/180*pi)+pi/4)/sin(theta_range(ii)/180*pi); % Rumus untuk elemen kedua SS
elseif jj == 2
SS(1+jj) = sin((phi_range(ll)/180*pi)+pi/4)/sin(theta_range(ii)/180*pi); % Rumus untuk elemen ketiga SS
end
end
PP = SS*NN*NN'*SS';
Pmusic(ll, ii) = abs(1/PP);
end
end
Pmusic = 10*log10(Pmusic/max(Pmusic)); % Spatial spectrum function
figure;
plot3(phi_range, theta_range, Pmusic, '-k')
xlabel('angle \phi/degree')
ylabel('angle \theta/degree')
zlabel('spectrum function P(\theta) /dB')
title('DOA estimation based on MUSIC algorithm')
grid on
e code:
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!