How to use fminsearch function in SIMULINK in a MATLAB function block?
3 views (last 30 days)
Show older comments
I am trying to fit a set of data points (time(t)) governed by the following equation
Vt = x4 - (x1/[(t^x2)*{log^x3(t)}])
to a set of known Vt and t values. x1, x2, x3 and x4 are the 4 parameters to be optimised. I initialise values for the parameters to be optimised and try and do a least squares error estimate by using fminsearch function. This works fine in MATLAB. But when trying to do the same online in a MATLAB function block in SIMULINK, i encounter the following problem
1.) I cannot use NESTED or ANONYMOUS functions as they are not supported for code generation. fminsearch syntax allows me to pass variables exclusively through a NESTED function or through an ANOMYMOUS function in a function handle.
How do i circumvent this problem?
Documentation of MATLAB 2014a and 2014b says that it supports fminsearch for code generation.
0 Comments
Answers (1)
Claudio Rey
on 7 Sep 2023
I am getting pretty disppointed that there is no answer on using fminsearch within Simulink. using coder.extrinsic DOES NOT HELP.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!