Main Content

downsample

Decrease sample rate of tireData object by integer factor

Since R2024a

    Description

    obj = downsample(obj,n) decreases the sample rate of each data channel in the tireData object specified by obj, keeping the first sample and then every nth sample specified by n.

    obj = downsample(___,offset) offsets the downsampled sequence by the number of samples specified by offset.

    example

    Examples

    collapse all

    Use the downsample function to decrease the sample rate of imported tire measurement data.

    Import and View Tire Measurement Data

    Import tire measurement data into a tireData object, td.

    td = tireData("example_data.tdx");

    Multiple Fz conditions are included in the data. Use the split function to separate the data by tire data channel Fz, resulting in four tireData objects.

    td = split(td,"Fz");

    Use the plot function to view the lateral force versus the slip angle using the normal force to assign colors and legend values.

    plot(td,DataVariableNames=["alpha","Fy"],ColorBy="Fz");

    Figure contains an axes object. The axes object with title Lateral force [N] vs Slip angle [rad], xlabel Slip angle [rad], ylabel Lateral force [N] contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent 2140, 4270, 5160, 6460.

    Downsample Tire Measurement Data

    Use the downsample function to decrease the sample rate of all the data channels in the tireData object array td.

    tdDown = downsample(td,5);

    Plot the resulting tireData objects in tdDown to visualize the modified data set.

    plot(tdDown,DataVariableNames=["alpha","Fy"],ColorBy="Fz");

    Figure contains an axes object. The axes object with title Lateral force [N] vs Slip angle [rad], xlabel Slip angle [rad], ylabel Lateral force [N] contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent 2140, 4270, 5170, 6450.

    Downsample Tire Measurement Data with Offset

    Specify offset to define the number of samples to offset the downsampled sequence.

    tdDown = downsample(td,5,10);

    Plot the resulting tireData objects in tdDown to visualize the modified data set.

    plot(tdDown,DataVariableNames=["alpha","Fy"],ColorBy="Fz")

    Figure contains an axes object. The axes object with title Lateral force [N] vs Slip angle [rad], xlabel Slip angle [rad], ylabel Lateral force [N] contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent 2140, 4270, 5170, 6450.

    Input Arguments

    collapse all

    Tire data, specified as a tireData object or an array of tireData objects.

    Downsampling factor, specified as a positive integer.

    Data Types: int8 | int16 | int32 | int64

    Number of samples to offset the downsampled sequence, specified as a positive integer.

    Data Types: int8 | int16 | int32 | int64

    Output Arguments

    collapse all

    Downsampled tire data, returned as a tireData object or an array of tireData objects.

    Version History

    Introduced in R2024a

    See Also