Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do I use the same user input for every iteration?

  1. Oct 21, 2012 #1
    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?
    Last edited: Oct 21, 2012
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted