crop
Description
This function requires Extended Tire Features for Vehicle Dynamics Blockset.
Examples
Use the crop function to remove tire data from tireData objects using these input criteria options:
Logical vector
Numeric vector
MATLAB® expression
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 elapsed time et, resulting in eight tireData objects.
td = split(td,"et");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.](../../examples/vdynblks/win64/CropImportedTireDataExample_01.png)
Crop Data Using Logical Vector
Create a logical vector using true values to indicate the indices of the data to remove. The logical vector must be the same length as the data channel vectors in each tireData object.
tf = false(length(td(1).alpha),1); tf(end-19:end) = true;
Use the crop function to remove the data at the indices indicated by the logical vector tf.
tdCrop = crop(td,tf);
Plot Result
Plot the resulting tireData objects in tdCrop to visualize the modified data set.
plot(tdCrop,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, 4260, 5160, 6450.](../../examples/vdynblks/win64/CropImportedTireDataExample_02.png)
Crop Data Using Numeric Vector
Create a numeric vector using integer values to indicate the indices of the data to remove.
idx = find(tf);
Use the crop function to remove the data at the indices indicated by the integer vector idx.
tdCrop = crop(td,idx);
Plot Result
Plot the resulting tireData objects in tdCrop to visualize the modified data set.
plot(tdCrop,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, 4260, 5160, 6450.](../../examples/vdynblks/win64/CropImportedTireDataExample_03.png)
Crop Data Using MATLAB Expression
Create a MATLAB expression string using data channel names to define the data to crop. This approach is useful when arrays of tireData objects have various lengths for data channels.
expression = "abs(alpha) > deg2rad(10)";Use the crop function to remove the data that results in the MATLAB expression expression evaluating to true.
tdCrop = crop(td,expression);
Plot Result
Plot the resulting tireData objects in tdCrop to visualize the modified data set.
plot(tdCrop,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, 4260, 5170, 6450.](../../examples/vdynblks/win64/CropImportedTireDataExample_04.png)
Input Arguments
Tire data, specified as a tireData object or an array of
tireData objects.
Criteria to remove tire data, specified as one of these values:
Logical vector —
truevalues indicate the indices to remove from the data channel vectors intireDataobjects. The logical vector must be the same length as the data channel vectors in eachtireDataobject.Integer vector — Integer values indicate the indices to remove from the data channel vectors in
tireDataobjects.String scalar — Provide a MATLAB expression using tire data channels. Data that results in the MATLAB expression evaluating to
trueis removed. Tire data channels must be a property of thetireDataobject. See tireData Properties.
Example: "abs(alpha)>deg2rad(10)" crops all tire data where the
absolute value of alpha is greater than 10
degrees.
Note
You cannot define workspace variables as a string in the criteria input. To use
workspace variable values, concatenate the criteria string with the variable value
prior to executing the crop function.
Data Types: int8 | int16 | int32 | int64 | logical | string
Output Arguments
Cropped tire data, returned as a tireData object or an array of
tireData objects.
Version History
Introduced in R2024a
See Also
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)