parameterCost
Syntax
Description
returns the cost of the untuned filter specified by the
cost = parameterCost(tuner)FilterInitializationFcn property of the tuner.
The function obtains the cost based on the detection log and truth data used in the latest
call to the tune object
function. You must at least use the tune function once before using
this syntax.
Examples
Load the tuning data containing the truth and detection data.
load("filterTuningData.mat","truth","detlog");
Create a trackingFilterTuner object. By default, the FilterInitializationFcn property of the tuner initializes a trackingEKF object.
tuner = trackingFilterTuner;
filter = feval(tuner.FilterInitializationFcn,detlog{1});Create a tunable parameter structure to evaluate the tuning cost directly.
params.ProcessNoise = filter.ProcessNoise; params.StatesCovariance = filter.StateCovariance; cost1 = parameterCost(tuner,params,detlog,truth)
cost1 = 9.2177
Alternately, you can first call the tune object function and evaluate tuning cost with and without the tuned parameters.
tunedParams = tune(tuner,detlog,truth);
Iter RMSE Step Size 0 9.2177 1 9.1951 0.1509 2 9.0458 1.5276 3 9.0456 0.0176 4 9.0452 0.0706 5 9.0452 0.0142 6 9.0452 0.0012 7 9.0452 0.0119 8 9.0452 0.0015 9 9.0451 0.0513 10 9.0450 0.0742 11 9.0450 0.0326 12 9.0450 0.0122
cost2 = parameterCost(tuner)
cost2 = 9.2177
cost3 = parameterCost(tuner,tunedParams)
cost3 = 9.0450
Input Arguments
Tracking filter tuner, specified as a trackingFilterTuner object.
Tunable parameters, specified as an N-element array of
structures. The fields of each structure must have the same name, class, and size as the
output of the tune object
function.
Data Types: struct
Detection log, specified as cell arrays of objectDetection objects.
Specify detectionLog based on the number of truth targets that you specify in the truth input argument.
One truth target — Specify
detectionLogas a T-by-N cell array ofobjectDetectionobjects. N is the number of Monte-Carlo runs. The number of time steps T does not have to be equal to the number of rows in the truth table. The timestamp of each detection does not have to match the time in the truth table.Multiple truth targets — Specify
detectionLogas an M-element cells, where each cell contains a cell array ofobjectDetectionobjects for the corresponding truth timetable. M is the number of truth tables. Across the M cells, the detection time, the number of detections, and the number of Monte-Carlo runs do not have to be the same.
Truth data, specified as a structure, table, timetable, cell array of structures, cell array of tables, cell array of timetables.
You can specify truth for one or more truth targets.
One truth target — Specify
truthas a truth structure, table, or timetable.When specified as a structure, the structure must contain a field
Timeand eitherPositionandVelocityfields or aStatefield.parameterCostconverts the structure to a timetable and uses it as defined below.When specified as a table, or timetable, the
truthmust have these variables as columns:Time— Time of the truth information, specified as a single, double, ordurationin each table row.Position— Position of the target at the time, specified as a 1-by-3 real-valued vector in each table row.Velocity— Velocity of the target at the time, specified as a 1-by-3 real-valued vector in each table row. This variable is optional.State— State of the target at the time, specified as 1-by-S real-valued vector in each table row, where S is dimension of the state.Note
When you specify the
Statecolumn, the tuner ignores thePositionandVelocitycolumns if specified.The definition of the
Statecolumn must be exactly the same as the state definition in the tuned filter. For example, if the filter defines its state as [x y v q], where x and y are positions in a 2-D rectangular frame, v is the speed, and q is the heading angle, you must specify the timetable with aStatecolumn in the same [x y v q] definition.
Multiple truth targets — Specify
truthas an M-element cell array of truth structures, tables, or timetables. Each truth structure, table, or timetable can have different initial and end times.
Output Arguments
Tuning cost, returned as a real scalar when you do not specify the
params input argument and returned as an
N-element vector when you specify the params
input argument. N is the number of tunable parameter structures
specified in the params input. The definition of the cost is the
same as the Cost property of the tuner.
Version History
Introduced in R2023aWhen specifying the truth timetable input, you can use tables or structures. Previously, you could only use timetables.
When specifying the truth timetable input of the tune function,
you can use a column called State to describe the truth target state.
Previously, you had to use the Position and Velocity
columns to describe the truth target state. Using the State column
provides more flexibility on defining target state.
Note that when the truth timetable contains the State column, the
tuner ignores the Position and Velocity columns if
specified.
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)