fsolve with structure of functions in a cell
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (1)
Peter
am 23 Apr. 2018
0 Stimmen
1 Kommentar
Walter Roberson
am 23 Apr. 2018
We leave solved problems available so that other people can learn from them.
Kategorien
Mehr zu Solver Outputs and Iterative Display finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!