www.gusucode.com > phased 案例源码 matlab代码程序 > phased/DirectivityCustomMicrophoneElementExample.m
%% Directivity of Custom Microphone Element % Compute the directivity of a custom microphone element. Create a custom % cardioid microphone, and plot the microphone's response at % 700 Hz for elevations between -90 and +90 degrees. %% % Define the pattern for the custom microphone element. The System object's % |PolarPatternAngles| property has default value of |[-180:180]| degrees. % Copyright 2015 The MathWorks, Inc. myAnt = phased.CustomMicrophoneElement; myAnt.PolarPatternFrequencies = [500 1000]; myAnt.PolarPattern = mag2db([... 0.5+0.5*cosd(myAnt.PolarPatternAngles);... 0.6+0.4*cosd(myAnt.PolarPatternAngles)]); %% % Calculate the directivity as a function of elevation at zero degrees % azimuth. elev = [-90:5:90]; azm = zeros(size(elev)); ang = [azm;elev]; freq = 700; d = directivity(myAnt,freq,ang); plot(elev,d) xlabel('Elevation (deg)') ylabel('Directivity (dBi)') %% % The directivity is maximum at $0^{\circ}$ elevation.