Using Fzero for one variable in a nonlinear equation with multiple variables

3 views (last 30 days)
Hi, If I have a non linear equation with multiple variables but I want to solve for one variable (in terms of those other variables) then can I use fzero? If so, how?
Thanks

Accepted Answer

Roger Stafford
Roger Stafford on 25 Oct 2014
Edited: Roger Stafford on 25 Oct 2014
You want a solution for r as an explicit function of a, b, dh, and de. You cannot accomplish that with 'fzero' or any of the functions of the Optimization Toolbox, which only give you solutions for particular numerical values of these parameters. Your only hope is 'solve' of the symbolic toolbox, and if that fails, it is simply something you presumably cannot achieve. There are many such equations whose explicit solutions are totally unknown to mathematicians, and this may be one of these.
  2 Comments
Roger Stafford
Roger Stafford on 25 Oct 2014
Perhaps I should expand a bit on my remarks about your equation, EeeJay.
You can read about the "LambertW function" at:
http://en.wikipedia.org/wiki/Lambert_W_function
where the implicit equation
w*exp(w) = z
is discussed and a method developed over many years to express w as an explicit function of z, (though it has more than one branch.) However, this function cannot be expressed in terms of any of the elementary functions that are common in mathematics. If this special development of the lambert w equation had not been carried out, we would still have to regard the above implicit equation as incapable of an explicit solution. As it turns out, there are many other implicit equations involving an exponential term which can be reduced to this simple equation and therefore also expressed in terms of the lambertw function.
Unfortunately, it appears that your equation, involving as it does three differing exponential expressions, is not one of those that can be so reduced, at least not on my version of the symbolic toolbox. If mathematicians were to devote a sufficient amount of effort in the direction of equations with two or more differing exponential terms, perhaps they would be able to reduce your equation to some explicit solution. Until that wonderful day comes, however, I am afraid you are doomed to always having to express your quantity r as a function that requires the use of an iterative routine like 'fzero' for each set of specific values of your four parameters in order to determine the unknown r.
EeeJay
EeeJay on 25 Oct 2014
Thank you, Roger! I understand about it being one of those functions. I think for such functions I have used graphing method before. Obviously one trivial solution is r=0 but there is also another non-trivial solution and this is why I was looking to check if I could express r as an explicit function of a,b, dh and de. I'll look at the link you posted.

Sign in to comment.

More Answers (1)

EeeJay
EeeJay on 25 Oct 2014
I have successfully solved for r in the following case:
syms r a b
f=r.^2-a.*b
solve(f,r)
This gives me r in terms of a and b but how do I use fzero for an equation like this:
f=(r.^2)-(r.*b)-(2.*r.*b.*exp(-r.*dh))-(r.*a)-(a.*b)+(2.*a.*b.*exp(-(r.*dh)))+(2.*r.*a.*exp(r.*de))+(2.*a.*b.*exp(r.*de))-3.*a.*b.*exp(r.*(de+dh));
where everything is a variable. I need to find r in terms of the other variables and I can't find examples which do this. The examples I'm finding are making the variables constant before using fzero.
Thanks in advance!

Categories

Find more on Function Handles in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!