Main Content

freqz

HRTF frequency response

Since R2024a

    Description

    example

    [h,f] = freqz(s) returns the complex frequency response and the frequency vector of the first measurement of the HRTF data.

    example

    [h,f] = freqz(s,Name=Value) specifies options using one or more name-value arguments.

    example

    freqz(___) with no output arguments plots the frequency response.

    Examples

    collapse all

    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)

    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

    collapse all

    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)

    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

    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

    Number of points in the frequency response, specified as a positive integer. For SimpleFreeFieldHRIR objects, the default value is max(2048,L), where 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

    collapse all

    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.

    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