I have a function in Matlab that finds the roots of a system of nonlinear equations. It calls for the system function, which is unique to each nonlinear system that I am trying to solve.

What I am trying to do is write a code that uses my root function to solve my system function. However, I also want the user to input the values of the constants in the system equations. If I write that in the system function, with each iteration that the root function does, I have to enter them again. That gets quite tiring.

I guess my question is, is there a trick to set the inputs of the systems function and have them used for every iteration in the root function?

What I am trying to do is write a code that uses my root function to solve my system function. However, I also want the user to input the values of the constants in the system equations. If I write that in the system function, with each iteration that the root function does, I have to enter them again. That gets quite tiring.

I guess my question is, is there a trick to set the inputs of the systems function and have them used for every iteration in the root function?

Last edited: