Intersection of piecewise defined functions.

조회 수: 2 (최근 30일)
Max
Max 2016년 2월 3일
댓글: Walter Roberson 2016년 2월 3일
Hello,
I would like to calculate the value for that two functions are equal:
function no. 1:
F_2_origin_cond = (1-((1- wblcdf(t-delta12_origin,eta_hat_2,beta_hat))./(1-Age_t1_origin))).*(t>=2000);
F_2_origin_cond = 0.*(t<2000);
function no. 2:
y=0.876;
Does somebody know if it is possible in MATLAB?

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 3일
By examination, the first function is 0 for all t < 2000 . That cannot possibly be 0.876. So the question comes down to finding (1-((1- wblcdf(t-delta12_origin,eta_hat_2,beta_hat))./(1-Age_t1_origin))) == 0.876 and if the answer is < 2000 then discard that answer.
F_2_origin_cond = @(t) (1-((1- wblcdf(t-delta12_origin,eta_hat_2,beta_hat))./(1-Age_t1_origin))) - 0.876;
t_target - fzero(F_2_origin_cond, [max(2000,deltal2_origin), inf])
The max() is there to select between the greatest of 2000 (the part at which the equation becomes valid) and delta12_origin, as wblcdf(t-delta12_origin,...) will be 0 for t < delta12_origin .
  댓글 수: 3
Max
Max 2016년 2월 3일
Sorry, I get the fault. You´re right.
Walter Roberson
Walter Roberson 2016년 2월 3일
probably a lower-case L vs digit-1 typo.

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

추가 답변 (1개)

John D'Errico
John D'Errico 2016년 2월 3일
편집: John D'Errico 2016년 2월 3일
Of course it is possible.
Hint: subtract the two, then search for a root. This applies even if one of the functions is not constant, as it is here.
So, you could use a numerical solver. Or you could use a symbolic solver.
As far as the function being a piecewise one, that is not relevant, since for t < 2000, the function is trivially zero, therefore the two can never be equal in that domain. So all that matters is you find a root of the difference above 2000 for t.
  댓글 수: 1
Max
Max 2016년 2월 3일
Hey John,
thanks for your answer. That what your have written is correct but what I´m searching for is how to do that in matlab (matlab source code).

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

카테고리

Help CenterFile Exchange에서 Utilities for the Solver에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by