www.gusucode.com > phased 案例源码 matlab代码程序 > phased/CustomCardioidMicrophoneResponseExample.m

    %% Custom Cardioid Microphone Response
% Create a custom cardioid microphone, and calculate the
% microphone response at 500, 1500, and 2000 Hz in two
% directions: _(0,0)_ azimuth and elevation, and _(40,50)_ azimuth and elevation.
sCustMic = phased.CustomMicrophoneElement;
sCustMic.PolarPatternFrequencies = [500 1000];
sCustMic.PolarPattern = mag2db([...
    0.5+0.5*cosd(sCustMic.PolarPatternAngles);...
    0.6+0.4*cosd(sCustMic.PolarPatternAngles)]);
resp = step(sCustMic,[500 1500 2000],[0 0; 40 50]')
%%
%
pattern(sCustMic,500,[-180:180],0,'Type','powerdb')