Finding root of nonlinear functions

조회 수: 2 (최근 30일)
University Glasgow
University Glasgow 2022년 9월 8일
댓글: Sam Chak 2022년 9월 8일
Please, how do I find all the roots this function:
y-0.8193318913*tanh(y)+0.2931044702e-2*tanh(y)/(0.7500000000e-3*y^2-0.1622336517e-1) = 0

채택된 답변

Torsten
Torsten 2022년 9월 8일
f = @(y)(y-0.8193318913*tanh(y)).*(0.7500000000e-3*y.^2-0.1622336517e-1)+0.2931044702e-2*tanh(y);
fun = @(y)f(y)./(0.7500000000e-3*y.^2-0.1622336517e-1);
y = -6:0.01:6;
plot(y,f(y))
x0 = [-5 -4];
s(1) = fzero(f,x0);
x0 = [-1 1];
s(2) = fzero(f,x0);
x0 = [4 5];
s(3) = fzero(f,x0);
s
s = 1×3
-4.5365 0 4.5365
fun(s)
ans = 1×3
1.0e-14 * 0.4951 0 -0.4951
  댓글 수: 1
Sam Chak
Sam Chak 2022년 9월 8일
👍, Yes, follow this method to find all real roots.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sam Chak
Sam Chak 2022년 9월 8일
Read about fzero().
The solution may look like this:
fun = @(y) y - 0.8193318913*tanh(y) + (0.2931044702e-2)*tanh(y)./(0.7500000000e-3*y.^2 - 0.1622336517e-1);
y0 = 0; % initial guess
y = fzero(fun, y0)
y = 0

카테고리

Help CenterFile Exchange에서 Optimization에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by