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

    %% Response of Heterogeneous Microphone ULA Array
% Find the response of a heterogeneous ULA array of 7 custom microphone elements with different responses.
%%
% *Note:* This example runs only in R2016b or later. If you are using an earlier
% release, replace each call to the function with the equivalent |step|
% syntax. For example, replace |myObject(x)| with |step(myObject,x)|.
%%
% Create two microphones with different response patterns.
mic1 = phased.CustomMicrophoneElement(...
    'FrequencyResponse',[20 20e3]);
mic1.PolarPatternFrequencies = [500 1000];
mic1.PolarPattern = mag2db([...
    0.5+0.5*cosd(mic1.PolarPatternAngles);...
    0.6+0.4*cosd(mic1.PolarPatternAngles)]);
mic2 = phased.CustomMicrophoneElement(...
    'FrequencyResponse',[20 20e3]);
mic2.PolarPatternFrequencies = [500 1000];
mic2.PolarPattern = mag2db([...
    ones(size(mic2.PolarPatternAngles));...
    ones(size(mic2.PolarPatternAngles))]);
%%
% Create the heterogeneous ULA.
array = phased.HeterogeneousULA(...
    'ElementSet',{mic1,mic2},...
    'ElementIndices',[1 1 2 2 2 1 1]);

%%
% Find the array response at 40° and 50° azimuth.
fc = [1500, 2000];
ang = [40 50; 0 0];
resp = array(fc,ang)