📄 partc.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Part C
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The power levels of the signals and the noise
P1_db = 60;
% Generate the signals 1 and 2 and the noise
s1 = (10^(P1_db/20))*v1*((randn(1,N)+j*randn(1,N))/sqrt(2));
s2 = (10^(P2_db/20))*v2*((randn(1,N)+j*randn(1,N))/sqrt(2));
w = (10^(Pn/20))*(randn(M,N) + j*randn(M,N))/sqrt(2); % Noise
% Add signals and noise to get the total array signal
x = s1 + s2 + w;
% Compute the true covariance matrix
% (remember to divide by 10 not 20 for powers in the covariance)
R_x = (10^(P1_db/10)) * v1 * v1' + (10^(P2_db/10)) * v2 * v2' + ...
(10^(Pn/10)) * eye(M);
% Generate the spatial matched filters to compute the steered
% response for angles from -90 to 90 degrees
phi = -90:0.2:90;
C_smf = exp(-j*2*pi*spacing*[0:(M-1)]'*sin(phi*pi/180))/sqrt(M);
% Use a tapered beamformer with 65 dB sidelobe levels
SLL_taper = 65;
t = chebwin(M,SLL_taper);
for m = 1:length(phi)
C_tbf(:,m) = diag(t)*C_smf(:,m);
C_tbf(:,m) = C_tbf(:,m)/sqrt(C_tbf(:,m)'*C_tbf(:,m));
end
% Compute the steered response
for k = 1:length(phi)
R_steer_smf(k) = mean(abs(C_smf(:,k)' * x).^2,2);
R_steer_tbf(k) = mean(abs(C_tbf(:,k)' * x).^2,2);
end
% Plot out the steered response in decibels
figure
plot(phi,10*log10(R_steer_smf),'b','linewidth',2.5);
xlabel('Angle (deg)','fontweight','bold','fontsize',20);
%xlabel('Angle(deg)','fontweigt','bold','fontsize',20);
ylabel('Steered Response (dB)','fontweight','bold','fontsize',20);
set(gca,'fontweight','bold','fontsize',18);
axis([-90 90 -5 65]);
grid
set(gca,'xtick',-90:15:90);
% Plot out the steered response in decibels
figure
plot(phi,10*log10(R_steer_tbf),'b','linewidth',2.5);
xlabel('Angle (deg)','fontweight','bold','fontsize',20);
ylabel('Steered Response (dB)','fontweight','bold','fontsize',20);
set(gca,'fontweight','bold','fontsize',18);
axis([-90 90 -5 65]);
grid
set(gca,'xtick',-90:15:90);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -