📄 beampattern.m
字号:
%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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -