I have faced a similar error previously while using the “Parameter Estimator” app and the reason for this error message is the “Value Set” attribute of the Parameter that you are trying to estimate.
Here when you select the optimization parameter as “Discrete” then you must provide a vector of possible values that the parameter can take, as an input to the “Value Set” attribute.
If the “Value Set” is a scalar, then the only possible value the parameter can take is the initial value of the parameter that is being set, hence it cannot be optimized.
Optimization parameters contain a “Free” attribute that indicates whether a parameter is “tunable” or not. When “Free” is set to true the parameter is said to be “tunable”.
When the “Value Set” attribute of all the optimization parameters is scalar then optimization cannot be performed as all the parameters are not “tunable”, giving rise to the following error:
“There are no parameters to optimize. The parameter argument of the optimize command must include at least one parameter with its "Free" property set to true.”
To resolve this error provide a vector of values as input to the “Value Set” attributes of the optimization parameters.
In “Parameter Estimator” app there are two types of “tunable” parameters,
- Parameters Tuned for All Experiments
- Parameters Tuned per Experiment
Parameters Tuned for All Experiments – These are the parameters that are shared between all the experiments and the estimator tries to find a single set of values that best fit the data from all the experiments.
Parameters Tuned per Experiment – These are the parameters that are estimated separately for each experiment which implies the estimator may find different set of parameter values for each experiment.
Hence, an optimization parameter can either be set as “Parameter Tuned for All Experiments” or as “Parameter Tuned per Experiment” but not both.
Therefore, removing either condition from a parameter, that is selected as both (based on the use case) would resolve the following error:
“Error: The parameter(s) 'Rs, Rsh' are specified as both global parameters to estimate and per-experiment parameters. Parameters must either be global or per-experiment but cannot be both.”
For more information, you can refer to the following documentation links:
- https://www.mathworks.com/help/releases/R2024b/sldo/ug/estimate-model-parameter-values-gui.html
- https://www.mathworks.com/help/releases/R2024b/sldo/ug/estimate-model-parameter-values-code.html
- https://www.mathworks.com/help/releases/R2024b/sldo/ref/param.discrete.html
I hope this helps in resolving the issue.