solve non-linear equation

조회 수: 3 (최근 30일)
Fernando Robert Ferrel Ballestas
편집: 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 CenterFile Exchange에서 Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by