1
votes

I am trying to use matlab's fsolve to solve a system of 4 nonlinear equations. I'm solving the system for each point in a grid of parameters by looping through each point and calling the fsolve function.

My problem is that I need to give some of these parameters as input to fsolve. These inputs should be treated as constants for each separate solving of the system.

Can anyone help me?

1
Including the code usually increases the chances of people answering your question. - tashuhka
You can pass whatever variables you need to your cost function by using a function handle like the following: fhand = @(x)foobar( x, a, b, c, ... ); In the above, x will be the vector used by fsolve and the other arguments (i.e., a, b, ...) will be unaltered and passed to the function foobar with whatever value they had when the funtion handle was defined. - AnonSubmitter85
Thanks! This helped me a lot! - Mahus

1 Answers

1
votes

you can just do:

result = fsolve(@(x) eqns(a,b,c,d),guess)

and in addition make the function eqns() with your equation set.