I'm having some trouble using fsolve on a composition of functions.
I've tried fsolve on a much simpler composition, and it worked just fine, so my code for the "real" problem probably needs to be tweaked.
My real problem starts with a Matlab function, f, that embeds nonlinear modeling code and the solutions gotten from the ode45 solver, and gives me as output only certain ODE solutions I'm interested in, e.g. solutions at the end, time T.
Then, in a separate function file, I write a function, g, that's a difference mapping that uses the outputs from f. So, it's g composed with f.
(The function g has the same inputs as the function f, and gives differences as outputs.)
Now I want to find multivariable roots of the difference mapping g, i.e. solving g = 0, using fsolve; however, I've been getting the message, "not enough input arguments".
Here's the gist of the code from my script file that's calling fsolve:
g = @DifferenceMap;
f = @ODE_solutions_time_T;
xdot_0 = 5;
ydot_0 = 8;
thetadot_0 = 1;
[ xdot_0, ydot_0, thetadot_0] = fsolve( g( f ) , [ xdot_0, ydot_0, thetadot_0 ] );
What am I missing?
Thanks,
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/590821-fsolve-handling-a-composition-of-functions-gives-the-error-not-enough-input-arguments#comment_1001776
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/590821-fsolve-handling-a-composition-of-functions-gives-the-error-not-enough-input-arguments#comment_1001776
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/590821-fsolve-handling-a-composition-of-functions-gives-the-error-not-enough-input-arguments#comment_1001797
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/590821-fsolve-handling-a-composition-of-functions-gives-the-error-not-enough-input-arguments#comment_1001797
Sign in to comment.