syntax to pass x0 values (for fsolve) from constant blocks to interpreted matlab function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
i use a interpeted matlab function to do fsolve inside simulink and i used constant blocks with a mux to supply the needed parameters.
is there a possibility to do the same with x0? if yes, what would the syntax be? i tried x0=[u(5),u(6),u(7)] or just [u(5),u(6),u(7)], but none of them seems to work.
fsolve(@(x)myfun(x,u(1),u(2),u(3),u(4)),x0,optimset('MaxFunEvals', 100, 'FunValCheck', 'on','MaxIter', 800000,'TolX', 1e-60,'TolFun', 1e-60))
best regards
0 Commenti
Risposte (1)
Kaustubha Govind
il 2 Ago 2012
You should probably create a wrapper function that has the two lines:
function y = callFsolve(u)
x0=[u(5),u(6),u(7)];
y = fsolve(@(x)myfun(x,u(1),u(2),u(3),u(4)),x0,optimset('MaxFunEvals', 100, 'FunValCheck', 'on','MaxIter', 800000,'TolX', 1e-60,'TolFun', 1e-60));
And then call callFsolve(u) from the block dialog. If it still doesn't work, you could set a breakpoint in your code to see what it going wrong.
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!