fsolve with structure of functions in a cell
Afficher commentaires plus anciens
Hi,
I'm trying to solve a structure of 10 equations using fsolve, but so far, Matlab refuses to use my cell as input:
eq =
Columns 1 through 5
[function_handle] [function_handle] [function_handle] [function_handle] [function_handle]
Columns 6 through 10
[function_handle] [function_handle] [function_handle] [function_handle] [function_handle]
Error using lsqfcnchk (line 114)
FUN must be a function handle.
Error in fsolve (line 198)
funfcn = lsqfcnchk(FUN,'fsolve',length(varargin),funValCheck,gradflag);
Error in NRTL (line 36)
fsolve({eq{1}; eq{2}; eq{3}; eq{4}; eq{5}; eq{6}; eq{7}; eq{8}; eq{9}; eq{10}},[0,0 0,0 0,0 0,0 0,0 0,0 0,0
0,0 0,0],options)
Matlab code (simplified):
modelRaf(i) = (((T(1,i).*G(1,i).*x_raf(1,j)) + (T(2,i).*G(2,i).*x_raf(2,j)) ... % a very long model
for i=1:2
eq{i} = str2func(['@(T) exp(',char(modelRaf(i)),') .* ',num2str(x_raf(2,i))]
end
options = optimoptions('fsolve','Display','none','PlotFcn',@optimplotfirstorderopt);
fsolve(eq,[0,0 0,0],options)
The model works (used it many times). Any sugestions?
Réponse acceptée
Plus de réponses (1)
Peter
le 23 Avr 2018
0 votes
1 commentaire
Walter Roberson
le 23 Avr 2018
We leave solved problems available so that other people can learn from them.
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!