Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Solving equations with "extra parameters" (passing extra parameters)
Posted:
Aug 31, 2012 3:01 AM


> Hi everyone, > > Im trying to solve a system of two eq and two > unknowns. I want to solve this system for different > values of two parameters. > What i did is create a vector with this values and > try to use two for loops to get the desired result > using solve command. > The problem is that solve command doesn´t allow the > parameters to change! > I tried using anonymous functions and nested > functions but couldn´t solve the problem. > Anyone has any ideas?? > Thank you very much for your time!
If your equations are nonlinear, use fsolve and call it as
for i=1:length(parameter1) p1 = parameter1(i); for j=1:length(parameter2) p2=parameter2(j); [x,Fval,exitflag] = fsolve(@(x)myfun(x,p1,p2),x0); ... end end
Best wishes Torsten.



