How can I use integral to solve a equation with two function handle?
3 ビュー (過去 30 日間)
古いコメントを表示
Hello, I want to solve the equation below solution = fzero(@(Cpk_hat) fun2,0.01) but I get the feedback :
'Undefined operator '==' for input arguments of type 'function_handle'.'
Error in fzero (line 314)
if fx == 0
Does anyone can tell me how to solve the problem?
thanks!
===========================================below is my code ======================================
n = 150;
w = 1.33;
p = 0.95;
s = 0.00969;
delta = 0.103;
alpha = ( n-1 )/2; beta = ( ((n-1)*s^2)./2 )^-1;
b1_of_y = @(y) 3*sqrt(n)*( Cpk_hat*sqrt( 2./((n-1)*y)) - w );
b2_of_y = @(y) 3*sqrt(n)*( (Cpk_hat + 2*delta./3)*sqrt( 2./((n-1)*y)) - w );
fun = @(y,Cpk_hat) ( (1./( gamma(alpha).*(y.^(alpha+1)) ) ).*exp(-1./y).*( normcdf(b1_of_y,0,1))+normcdf(b2_of_y,0,1) - 1);
fun2 = @(Cpk_hat) integral(@(y) fun,0,inf) - p ;
solution = fzero(@(Cpk_hat) fun2,0.01) ;
0 件のコメント
採用された回答
Walter Roberson
2017 年 11 月 18 日
solution = fzero(fun2, 0.01) ;
or
solution = fzero(@(Cpk_hat) fun2(Cpk_hat), 0.01) ;
5 件のコメント
Walter Roberson
2017 年 11 月 19 日
Let me put it this way: with that formula, you are attempting to do the equivalent of
solution = fzero(@(Cpk_hat) -infinity, 0.01) ;
The value of Cpk_hat does not matter: whatever numeric value you give to Cpk_hat, the result of the integral is going to be -infinity . It will never equal 0.
Walter Roberson
2017 年 11 月 19 日
fzero can only solve functions that cross zero. Your function does not cross zero.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!