필터 지우기
필터 지우기

Solving nonlinear function using fzero, Error Function values at the interval endpoints must differ in sign.

조회 수: 1 (최근 30일)
```
Imp=100;
t0=1e-6;
P=204000000;
Tf=2e-3;
x = fzero( @(x) myfunction(x, t0, Imp, P, Tf), [1.001, 10000]);
function [f] = myfunction( x, t0, Imp, P0, Tf)
f = Imp - (-(P0*t0*(x-1.0)*(x^(-Tf/(t0*(x-1.0)))-1.0))/(log(x)*(x^(-1.0/(x-1.0)) -x^(-x/(x-1.0))))+(P0*t0*(x^(-(Tf*x)/(t0*(x-1.0)))-1.0)*(x-1.0))/(x*log(x)*(x^(-1.0/(x-1.0))-x^(-x/(x-1.0)))));
end
```
x must bigger than 1.0
I don't think these input will make fzero suffer
thank you
  댓글 수: 4
Walter Roberson
Walter Roberson 2022년 6월 4일
편집: Walter Roberson 2022년 6월 4일
It is +100 at x=-1 but change x away from -1 and it goes complex, so at the moment I have no evidence that it has a real root.
Sam Chak
Sam Chak 2022년 6월 5일
Once you have found the root of nonlinear function, can you verify if the solution really crosses 0?
Imp = 100;
t0 = 1e-6;
P0 = 204000000;
Tf = 2e-3;
f = @(x) Imp - (-(P0*t0*(x-1.0)*(x^(-Tf/(t0*(x-1.0)))-1.0))/(log(x)*(x^(-1.0/(x-1.0)) -x^(-x/(x-1.0))))+(P0*t0*(x^(-(Tf*x)/(t0*(x-1.0)))-1.0)*(x-1.0))/(x*log(x)*(x^(-1.0/(x-1.0))-x^(-x/(x-1.0)))));

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

답변 (1개)

Lateef Adewale Kareem
Lateef Adewale Kareem 2022년 6월 4일
Imp=100;
t0=1e-6;
P=204000000;
Tf=2e-3;
x = nan;
options = optimset('Display','off'); % show iterations
x0 = 2;
while(isnan(x))
x = fzero( @(x) myfunction(x, t0, Imp, P, Tf), x0, options);
x0 = x0*1.2;
end
disp(['x = ', num2str(x)])
x = 1.762566874060497e+21
function [f] = myfunction( x, t0, Imp, P0, Tf)
f = Imp - (-(P0*t0*(x-1.0)*(x^(-Tf/(t0*(x-1.0)))-1.0))/(log(x)*(x^(-1.0/(x-1.0)) -x^(-x/(x-1.0))))+(P0*t0*(x^(-(Tf*x)/(t0*(x-1.0)))-1.0)*(x-1.0))/(x*log(x)*(x^(-1.0/(x-1.0))-x^(-x/(x-1.0)))));
end

카테고리

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

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by