# freqz

## Description

## Examples

### Compute Frequency Response of HRTF Data

Read in a SOFA file containing HRTF measurements.

`s = sofaread("ReferenceHRTF.sofa");`

Use `freqz`

to compute the frequency response of the first measurement for the first receiver.

[h,f] = freqz(s);

Call `freqz`

with no output arguments to plot the frequency response of the first measurement for the first receiver.

freqz(s)

### Compute Frequency Response in Specified Plane

Read in a SOFA file containing HRTF measurements.

`s = sofaread("ReferenceHRTF.sofa");`

Select the HRTF measurements in the sagittal plane at a lateral angle of 45 degrees. Plot the frequency responses of the second receiver for these measurements.

idx = findMeasurements(s,Plane="sagittal",PlaneOffsetAngle=45); freqz(s,MeasurementIndex=idx,Receiver=2) legend(Location="southeast")

## Input Arguments

`s`

— SOFA object

`SimpleFreeFieldHRIR`

object | `SimpleFreeFieldHRSOS`

object | `SimpleFreeFieldHRTF`

object

SOFA object, specified as one of the following objects.

### Name-Value Arguments

Specify optional pairs of arguments as
`Name1=Value1,...,NameN=ValueN`

, where `Name`

is
the argument name and `Value`

is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.

**Example: **`freqz(s,NPoints=1024)`

`MeasurementIndex`

— Indices of measurements

1 (default) | vector of positive integers

Indices of measurements to use for the frequency response, specified as a vector
of positive integers. The indices must correspond to measurements in the data of the
SOFA object `s`

.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

`Receiver`

— Indices of receivers

1 (default) | vector of positive integers

Indices of the receivers to use for the frequency response, specified as a vector of positive integers.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

`NPoints`

— Number of points in frequency response

positive integer

Number of points in the frequency response, specified as a positive integer. For
`SimpleFreeFieldHRIR`

objects, the default value is
`max(2048,`

, where *L*)*L* is
the length of the HRTF impulse responses. For `SimpleFreeFieldHRSOS`

objects, the default value is 2048.

This argument does not apply to `SimpleFreeFieldHRTF`

objects.

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

## Output Arguments

`h`

— Complex frequency response

*N*-by-*M*-by-*R* array

Complex frequency response of the HRTF data, returned as an
*N*-by-*M*-by-*R* array, where:

*N*is the length of the frequency response.*M*is the number of selected measurements defined by`MeasurementIndex`

.*R*is the number of selected receivers defined by`Receiver`

.

`f`

— Frequencies

vector of length *N*

Frequencies in Hz corresponding to the frequency response, returned as a vector of
length *N*, where *N* is the length of the frequency
response.

## Version History

**Introduced in R2024a**

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)