I want to make a slight change to a MATLAB function at each step in a for loop. My function is too complicated to write as anonymous. Is there any way to change an m-file function at each step?
Additional Info:
My function is an equations with 8 inputs and infinitely many solutions. I want set 7 of the inputs and then use fsolve to find the 8th. vary some of these 7 fixed inputs in a for loop so that I can create a graph of the solutions to this equation.
Let’s make an example with two inputs, of which you want to change one. Since you claim your function is really complicated, let’s write it into a file called
complicated.m, which we save on the Matlab path.Say we want to change
v1andv2at every iteration in the loop and find a root of the polynomial and plot it