solve non-linear equation

5 ビュー (過去 30 日間)
Fernando Robert Ferrel Ballestas
Fernando Robert Ferrel Ballestas 2023 年 3 月 20 日
編集済み: Matt J 2023 年 3 月 20 日
Hello everybody,
I have an equation having the following form:
G = e^(-z)+ pho*e^(L-2z); with pho, G and L constant. I would like to find the z value. Could you suggest me a function to implement a code for solving my equation?
Thank you in advance
Fernando.

採用された回答

David Hill
David Hill 2023 年 3 月 20 日
Use fzero
eqn=@(z)exp(-z)+pho*exp(L-2*z)-G;%you could plot the function to find the approximate location of the root
z=fzero(eqn,0)

その他の回答 (1 件)

Matt J
Matt J 2023 年 3 月 20 日
編集済み: Matt J 2023 年 3 月 20 日
You can solve for x=e^(-z) using roots. Then use z=-log(x).
Example:
z=2.4;
pho=2;
L=2;
G = exp(-z) + pho*exp(L-2*z);
x=roots([pho*exp(L),1,-G]);
z=-log(x(x>0))
z = 2.4000

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by