Hi, I need to solve equations of the type b = @(x,s) solve(bb==x-s*icdf('Normal',bb,0,1),bb)
and after the function call
>> b(0.2,0.4)
I get this error. Can anyone help me?
Best,
Christian
Error using symengine Unable to prove 'bb < 0 | 1 < bb' literally. Use 'isAlways' to test the statement mathematically.
Error in sym/subsindex (line 821) X = find(mupadmex('symobj::logical',A.s,9)) - 1;
Error in sym/privsubsasgn (line 1096) L_tilde2 = builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/subsasgn (line 933) C = privsubsasgn(L,R,inds{:});
Error in norminv (line 57) p(p < 0 | 1 < p) = NaN;
Error in icdf (line 91) x = norminv(p,a,b);
Error in @(x,s)solve(bb==x-s*icdf('Normal',bb,0,1),bb)

 채택된 답변

Star Strider
Star Strider 2018년 9월 20일

0 개 추천

It is probably best to avoid the Symbolic Math Toolbox for such problems.
Try this:
b = @(x,s,bb) x-s*icdf('Normal',bb,0,1)-bb;
B = fsolve(@(bb)b(x,s,bb), 0.01)
You may need a different initial parameter estimate (I used 0.01 here), depending on what ‘x’ and ‘s’ are. This uses the Optimization Toolbox fsolve (link) function. It is more robust than fzero.

댓글 수: 2

Christian Bauer
Christian Bauer 2018년 9월 25일
thanks a lot. That works fine.
Star Strider
Star Strider 2018년 9월 25일
As always, my pleasure.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2018년 9월 20일

댓글:

2018년 9월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by