legend problem Not enough input arguments

The legend of the picture is chaos.
1567394765(1).png

3 commentaires

Walter Roberson
Walter Roberson le 2 Sep 2019
Please show your code.
clear all
close all
clc
fs=10e3;
f0=3e3;
w0=2*pi*f0;
c=1500;
lambda=c/f0;
array_num=10;
% array_d=0.5*lambda;
array_d=lambda/2;
array_layout=[0:array_num-1].'*array_d;
snapnum=500;
unitrad=pi/180;
theta_target=[0]*unitrad;
SNR=[20];
TargetNum=length(theta_target);
a_target=exp(1i*2*pi*array_layout*sin(theta_target)/lambda);
tic
X=(ones(array_num,1)*10.^(SNR/20)).*a_target*randn(TargetNum,snapnum); X=A*s10*500
Noise=randn(array_num,snapnum);
X_rec=X+Noise;
Rx=X_rec*X_rec'/snapnum;
% Rx=a_target*diag(10.^(SNR/10))*a_target'+eye(array_num);
index_P=0;
for theta=-90:0.5:90
theta_rad = theta*pi/180;
index_P=index_P+1;
tao=array_layout*sin(theta_rad)/c;
w=exp(1i*w0*tao);
w=w/(w'*w);
P(index_P)=abs(w'*Rx*w);
end
plot(-90:0.5:90,10*log10(P/max(P)));
toc
index_P=0;
for theta=-90:0.5:90
theta_rad = theta*pi/180;
index_P=index_P+1;
tao=array_layout*sin(theta_rad)/c;
a=exp(1i*w0*tao);
w_mvdr=inv(Rx)*a/(a'*inv(Rx)*a);
unitrad(index_P,1)=(a'*inv(Rx)*a);
P_MVDR(index_P)=abs(w_mvdr'*Rx*w_mvdr);
end
hold on
plot(-90:0.5:90,10*log10(P_MVDR/max(P_MVDR)))
[vec,val]=eig(Rx);
[eigval,eigindx]=sort(diag(val),'descend');
Un=vec(:,eigindx(TargetNum+1:end));
index_P=0;
for theta=-90:0.2:90
theta_rad = theta*pi/180;
index_P=index_P+1;
tao=array_layout*sin(theta_rad)/c;
a=exp(j*w0*tao);
P_MUSIC(index_P)=(a'*a)/abs(a'*Un*Un'*a);
norm(a'*Un);
end
plot(-90:0.2:90,10*log10(P_MUSIC/max(P_MUSIC)));
legend('CBF','MVDR','MUSIC')%,'orientation','horizontal'
title('空间谱')
xlabel('角度/°')
ylabel('归一化空间谱')
Caution: your line
X=(ones(array_num,1)*10.^(SNR/20)).*a_target*randn(TargetNum,snapnum); X=A*s10*500
includes U+FF08 and U+FF09, which are "full width left parenthesis" and "full width right parenthesis" . It is the
X=A*s10*500
The two characters that show up in red here are not ( and ), they are "full width" parenthesis.
If you change that to
X=A*S(10*500)
then you have the problem that S only has 16 elements. Perhaps it is
X=A*S*(10*500)
??

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Animation dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by