I am trying to use 'fsolve' in Simulink, and I found the following thread on Mathworks:
I used the same technique as 'Kaustubha Govind' mentioned for a model I am trying to design in Simulink, and I am running into more errors. To give a basic idea about what I am trying to do, I have the following structure. I am using the 'Interpreted Matlab Function' block in Simulink.
Here, x0 is a 1 X 12 matrix and u(1)..,u(16) are scalars. 'sample' is a function (m-file) that I have saved in the Matlab folder. To start with, Have I framed the 'Interpreted Matlab function' properly?
After I run this model, I get the following errors:
1) Error in 'Model/Subsystem/Interpreted MATLAB Function' while evaluating expression.
2) Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
3) Too many output arguments.
Are you able to run fsolve with similar input arguments (as passed in from the Interpreted MATLAB Function block) outside of Simulink? Please set a breakpoint in your S-function code to ensure that the inputs are passed in correctly.