Main Content

impz

Head-related impulse response

Since R2024a

    Description

    example

    [h,t] = impz(s) returns the head-related impulse response of the first measurement and the corresponding time vector.

    example

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

    example

    impz(___) with no output arguments plots the impulse response.

    Examples

    collapse all

    Read in a SOFA file containing HRTF measurements.

    s = sofaread("ReferenceHRTF.sofa");

    Use impz to compute the impulse response of the first measurement for the first receiver.

    [h,t] = impz(s);

    Call impz with no output arguments to plot the impulse response of the first measurement for the first receiver.

    impz(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 impulse responses of the second receiver for these measurements.

    idx = findMeasurements(s,Plane="sagittal",PlaneOffsetAngle=45);
    impz(s,MeasurementIndex=idx,Receiver=2)

    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: impz(s, MeasurementIndex=1, Receiver=[1 2])

    Indices of measurements to use for the impulse 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 impulse response, specified as a vector of positive integers.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Length of the impulse response, specified as a positive integer.

    For SimpleFreeFieldHRIR objects, the default value is the length of the impulse response measurements in the HRTF data. For SimpleFreeFieldHRSOS objects, the default value is the maximum length returned by impzlength over all of the SOS filters in the HRTF data.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Impulse response, returned as an N-by-M-by-R array, where:

    • N is the length of the impulse response.

    • M is the number of selected measurements defined by MeasurementIndex.

    • R is the number of selected receivers defined by Receiver.

    Time vector in seconds corresponding to the impulse response, returned as a vector of length N, where N is the length of the impulse response.

    Version History

    Introduced in R2024a