# phased.CustomMicrophoneElement

Custom microphone element

## Description

The CustomMicrophoneElement System object™ models a microphone element with a custom spatial response pattern.

To compute the response of the microphone element for specified directions:

1. Create the phased.CustomMicrophoneElement object and set its properties.

2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

## Creation

### Description

example

microphone = phased.CustomMicrophoneElement creates a custom microphone System object, microphone, with default object properties.

example

microphone = phased.CustomMicrophoneElement(Name=Value) creates a custom microphone object, microphone, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1=Value1,...,NameN=ValueN).

Example: microphone = phased.CustomMicrophoneElement(FrequencyVector=[0 1000],FrequencyResponse=[0 -10],PolarPatternFrequencies=[100 1000]) creates a custom microphone element with its frequency response specified at 0 and 1000 Hz. The frequency response at these frequencies is 0 and -10 dB. The pattern frequencies are 100 and 1000 Hz.

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

The frequencies where the element responses are measured, specified as 1-by-L real-valued vector of positive values. The elements of the vector must be in increasing magnitude. The microphone element has no response outside the specified frequency range. Units are Hz.

Data Types: double

Frequency responses measured at the frequencies defined in the FrequencyVector property, specified as a1-by-L real-valued vector. The length of the vector must equal the length of the frequency vector specified in the FrequencyVector property. Units are dB.

Data Types: double

Measuring frequencies of the polar patterns, specified as a1-by-M real-valued vector of positive values. The measuring frequencies must be within the frequency range specified in the FrequencyVector property. Units are Hz.

Data Types: double

Measuring angles in degrees of the polar patterns, specified as a 1-by-N real-valued vector. The angles are measured from the central pickup axis of the microphone, and must be between –180° and 180°, inclusive.

Data Types: double

Polar patterns of the microphone element, specified as an M-by-N real-valued matrix. M is the number of measuring frequencies specified in the PolarPatternFrequencies property. N is the number of measuring angles specified in the PolarPatternAngles property. Each row of the matrix represents the magnitude of the polar pattern measured at the corresponding frequency specified in the PolarPatternFrequencies property and corresponding angles specified in the PolarPatternAngles property.

The pattern is assumed to be measured in the azimuth plane where the elevation angle is 0 and where the central pickup axis is assumed to be zero degrees azimuth and zero degrees elevation. The polar pattern is assumed to be symmetric around the central axis and therefore the microphone’s response pattern in 3-D space can be constructed from the polar pattern. Units are dB.

Data Types: double

## Usage

### Description

example

RESP = microphone(FREQ,ANG) returns the microphone’s magnitude response, RESP, at frequencies specified in FREQ and directions specified in ANG.

Note

The object performs an initialization the first time the object is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.

### Input Arguments

expand all

Signal frequencies, specified as a 1-by-P row vector of positive values. Units are Hz.

Response directions, specified as a 1-by-Q vector of real-values or a 2-by-Q matrix of real-values.

• If ANG is a 1-by-Q vector, each element specifies a direction’s azimuth angle. The azimuth angle must be between –180° and 180°, inclusive. In this case, the corresponding elevation angle is assumed to be zero.

• If ANG is a 2-by-Q matrix, each column of the matrix specifies the direction in the form [azimuth;elevation]. The azimuth angle must be between –180° and 180°, inclusive. The elevation angle must lie between –90° and 90°, inclusive.

Units are in degrees.

### Output Arguments

expand all

Microphone magnitude response, returned as an Q-by-P real-valued matrix. The matrix contains the responses of the microphone element at the Q angles specified in ANG and the P frequencies specified in FREQ.

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

 beamwidth Compute and display beamwidth of sensor element pattern directivity Directivity of antenna or transducer element isPolarizationCapable Antenna element polarization capability pattern Plot antenna or transducer element directivity and patterns patternAzimuth Plot antenna or transducer element directivity and pattern versus azimuth patternElevation Plot antenna or transducer element directivity and pattern versus elevation
 step Run System object algorithm release Release resources and allow changes to System object property values and input characteristics reset Reset internal states of System object

## Examples

collapse all

Construct a custom cardioid microphone with an operating frequency of 700 Hz. Find the microphone response in the directions: (0,0) degrees azimuth and elevation and (40,50) degrees azimuth and elevation.

microphone = phased.CustomMicrophoneElement;
microphone.PolarPatternFrequencies = [500 1000];
microphone.PolarPattern = mag2db([ ...
0.5+0.5*cosd(microphone.PolarPatternAngles); ...
0.6+0.4*cosd(microphone.PolarPatternAngles)]);
fc = 700;
ang = [0 0; 40 50]';
resp = microphone(fc,ang)
resp = 2×1

1.0000
0.7424

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. Then display the microphone pattern.

microphone = phased.CustomMicrophoneElement( ...
PolarPatternFrequencies=[500 1000]);
microphone.PolarPattern = mag2db([...
0.5+0.5*cosd(microphone.PolarPatternAngles);...
0.6+0.4*cosd(microphone.PolarPatternAngles)]);

Obtain the microphone response in two directions.

resp = microphone([500 1500 2000],[0 0; 40 50]')
resp = 2×3

1.0000    1.0000    1.0000
0.7424    0.7939    0.7939

Display the microphone power pattern.

pattern(microphone,500,-180:180,0,'Type','powerdb')

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.

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.

Show that the phased.CustomMicrophoneElement microphone element does not support polarization.

microphone = phased.CustomMicrophoneElement;
isPolarizationCapable(microphone)
ans = logical
0

The returned value 0 shows that the custom microphone element does not support polarization.

Design a cardioid microphone to operate in the frequency range between 500 and 1000 Hz.

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');

Plot a $u$-cut of the power pattern of a custom cardioid microphone designed to operate in the frequency range 500-1000 Hz.

Create a cardioid microphone.

sCustMike = phased.CustomMicrophoneElement;
sCustMike.PolarPatternFrequencies = [500 1000];
sCustMike.PolarPattern = mag2db([...
0.5+0.5*cosd(sCustMike.PolarPatternAngles);...
0.6+0.4*cosd(sCustMike.PolarPatternAngles)]);

Plot the power pattern.

fc = 500;
pattern(sCustMike,fc,[-1:.01:1],0,...
'CoordinateSystem','uv',...
'Type','powerdb');

Plot the 3-D magnitude pattern of a custom cardioid microphone with both the azimuth and elevation angles restricted to the range -40 to 40 degrees in 0.1 degree increments.

Create a custom microphone element with a cardioid pattern.

sCustMike = phased.CustomMicrophoneElement;
sCustMike.PolarPatternFrequencies = [500 1000];
sCustMike.PolarPattern = mag2db([...
0.5+0.5*cosd(sCustMike.PolarPatternAngles);...
0.6+0.4*cosd(sCustMike.PolarPatternAngles)]);

Plot the 3-D magnitude pattern.

fc = 500;
pattern(sCustMike,fc,[-40:0.1:40],[-40:0.1:40],...
'CoordinateSystem','polar',...
'Type','efield');

Plot the azimuth directivity pattern of a custom cardioid microphone at both 0 and 30 degrees elevation.

Create a custom microphone element with a cardioid pattern.

sCustMike = phased.CustomMicrophoneElement;
sCustMike.PolarPatternFrequencies = [500 1000];
sCustMike.PolarPattern = mag2db([...
0.5+0.5*cosd(sCustMike.PolarPatternAngles);...
0.6+0.4*cosd(sCustMike.PolarPatternAngles)]);

Plot the directivity at 500 Hz.

fc = 500;
patternAzimuth(sCustMike,fc,[0 30])

Plot the directivity for a reduced range of azimuth angles using the Azimuth parameter. Notice the change in scale.

fc = 500;
patternAzimuth(sCustMike,fc,[0 30],...
'Azimuth',[-40:.1:40])

Plot the elevation directivity pattern of a custom cardioid microphone at both 0 and 45 degrees azimuth.

Create a custom microphone element with a cardioid pattern.

sCustMike = phased.CustomMicrophoneElement;
sCustMike.PolarPatternFrequencies = [500 1000];
sCustMike.PolarPattern = mag2db([...
0.5+0.5*cosd(sCustMike.PolarPatternAngles);...
0.6+0.4*cosd(sCustMike.PolarPatternAngles)]);

Plot the directivity at 500 Hz.

fc = 500;
patternElevation(sCustMike,fc,[0 30])

Plot the directivity for a reduced range of azimuth angles using the Azimuth parameter. Notice the change in scale.

fc = 500;
patternElevation(sCustMike,fc,[0 45],...
'Elevation',[-40:.1:40])

## Algorithms

The total response of a custom microphone element is a combination of its frequency response and spatial response. phased.CustomMicrophoneElement calculates both responses using nearest neighbor interpolation and then multiplies them to form the total response. When the PolarPatternFrequencies property value is nonscalar, the object specifies multiple polar patterns. In this case, the interpolation uses the polar pattern that is measured closest to the specified frequency.

## Version History

Introduced in R2011a