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

    %% Azimuth Power Pattern and Directivity of Cardioid Microphone
% Design a cardioid microphone to
% operate in the frequency range between 500 and 1000 Hz.

% Copyright 2015 The MathWorks, Inc.

sCustMike = phased.CustomMicrophoneElement;
sCustMike.PolarPatternFrequencies = [500 1000];
sCustMike.PolarPattern = mag2db([...
    0.5+0.5*cosd(sCustMike.PolarPatternAngles);...
    0.6+0.4*cosd(sCustMike.PolarPatternAngles)]);
%%
% Display a polar plot of an azimuth cut of the response at 500 Hz and 1000 Hz.
fc = 500;
pattern(sCustMike,[fc 2*fc],[-180:180],0,...
    'CoordinateSystem','polar',...
    'Type','powerdb');

%%
% Plot the directivity as a line plot for the same two frequencies.
pattern(sCustMike,[fc 2*fc],[-180:180],0,...
    'CoordinateSystem','rectangular',...
    'Type','directivity');