How can i add Elevation Degree to my Script?
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Gandham Heamanth
2023년 7월 5일
편집: Gandham Heamanth
2023년 7월 5일
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:
카테고리
도움말 센터 및 File Exchange에서 Direction of Arrival Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
