beampattern.m
来自「麦克风阵列形成的波束beampattern图形」· M 代码 · 共 56 行
M
56 行
%This program is designed to produce a N elements SLA's beampattern
%N: the number of elements
%d2lambda: the ratio of spacing between two elements and wavelength
%theta: angle
%thetaT: steered angle
%B: beampattern
clear all;
N=4;
d=0.04; %the spacing of the array
c=340; %the speed of the sound
f_l=200;
f_u=8000;
f=[f_l:50:f_u];
d2lambda=d*f./c;
theta=[0:pi/360:pi];
thetaT=pi/2;
[theta,d2lambda]=meshgrid(theta,d2lambda);
num=sin(pi*N*d2lambda.*(cos(theta)-cos(thetaT)));
den=sin(pi*d2lambda.*(cos(theta)-cos(thetaT)));
B=1/N*num./den;
figure(1);
B_amp(:,:)=20*log10(abs(B(:,:)));
for i=1:157
for j=1:361
if(B_amp(i,j)<-20)
B_amp(i,j)=-20;
end
end
end
mesh(180/pi*theta,f,B_amp);
axis([0,180,f_l,f_u,-20,0]);
%figure(2);
%polardb(theta(1,:),20*log10(abs(B(155,:))),-40,'b');
% figure(3);
% polardb(theta(1,:),20*log10(abs(B(151,:))),-40,'b');
% figure(4);
% polardb(theta(1,:),20*log10(abs(B(141,:))),-40,'b');
% figure(5);
% polardb(theta(1,:),20*log10(abs(B(131,:))),-40,'b');
% figure(6);
% polardb(theta(1,:),20*log10(abs(B(121,:))),-40,'b');
% figure(7);
% polardb(theta(1,:),20*log10(abs(B(111,:))),-40,'b');
% figure(8);
% polardb(theta(1,:),20*log10(abs(B(101,:))),-40,'b');
% figure(9);
% polardb(theta(1,:),20*log10(abs(B(91,:))),-40,'b');
% figure(10);
% polardb(theta(1,:),20*log10(abs(B(81,:))),-40,'b');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?