MATLAB Answers

0

Do I need to reset Fsolve Parameters if I use Fsolve twice in my code ?

Asked by farzad on 6 Jul 2019
Latest activity Commented on by dpb
on 7 Jul 2019
Hi All
If I have to use Fsolve twice in my code, do I need to reset any paramter ?
[x,fval,exitflag,output] = fsolve(fun,x0initial,options);

  8 Comments

"problem is solved if fsolve resolves itself"
What does this mean? How can it "resolve itself"? It operates on precisely what you provide it -- if you don't change anything in the call to it, then it'll simply do the same thing twice.
Also Star-S's comment is most pertinent with the shred of additional info provided -- but still not at all enough to comment fully.
Remember, we only know of your problem from what you tell us; you understand what it is you're trying to do so shorthand descriptions are meaningful to you--for us, "not so much!" as we don't have any a priori info.
Ah sorry I didn't clarify I did not use exactly the same formulation every time That was only an example
Well, again, all we see is what you post...
So, is the Q? closed? Or is there still some issue?

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 6 Jul 2019
 Accepted Answer

No. However if you do not change any of the parameters and the function does not involve random variables, then the second call would give the same result as the first call.
fsolve does not modify any of the input parameters.
I do sometimes see people using code such as
x = [0,10]
x = fzero(SomeFunction, x0, x);
and then get surprised when they try to use x as if it were still the vector instead of having been replaced with the specific solution.

  1 Comment

Good point about the RVs, Walter.

Sign in to comment.