Hello,
I wrote a simple code for finding the upper limit of an integral. However, I am receiving the error message of:
Error using fzero (line 306) FZERO cannot continue because user-supplied function_handle ==> @(x)(fun2-0.05) failed with the error below. Undefined function 'minus' for input arguments of type 'function_handle'. Error in samplecode (line 6) pLB = fzero(G1,1);
The code I wrote is:
fun = @(x)(8760.*x).^2.*exp(-x.*8760).*lognpdf(x,-5.809,1.4); den = quadgk(fun,0.00003,0.04); fun2 = @(x)(1/den).*(8760.*x).^2.*exp(-x.*8760).*lognpdf(x,-5.809,1.4); G1 = @(x)(fun2 - 0.05); pLB = fzero(G1,1);
I was wondering why I am receiving this error message. And, what would be the correct way of coding it? Any help will be appreciated.
Best Answer