Using fsolve in MATLAB FUNCTION BLOCK in Simulink
Show older comments
Hi,
I am using a S-function builder to read the data from my arduino. The buf0 gives me the reading of the sensor. Then, I would like to send the buf0 as u to the MATLAB FUNCTION BLOCK, and the output is y. However, the output of y gives me 0 all the time, which is not changing with the input u.
function y = fcn(u)
F=@(x)[10*exp(-3*10^(-4)*x)+23*exp(-6*10^(-6)*x)-u];
y = fsolve(F,0,optimoptions('fsolve','Algorithm','levenberg-marquardt'));
I have tried to use MATLAB FUNCTION BLOCK with y = u and it works. So, i believe the problem is with the fsolve function.
Therefore, I would like to ask how to use fsolve in MATLAB FUNCTION BLOCK in Simulink.
Thank you.

1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!