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

  • Thread starter putio_d
  • Start date
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:

Want to reply to this thread?

"How do I use the same user input for every iteration?" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving