The error message "DOUBLE cannot convert the input expression into a double array"

syms x i z;
offset=3;
n=10;
lambda=1/(10.^((20 - (128.1+37.6*log10(150.*10^-3)))./10));
beta=10^(offset/10);
fx=(lambda^n)*(x^(n-1))*exp(-lambda*x)/factorial(n-1);
P_cond=1-symsum(1/factorial(i)*exp(-lambda*x/beta)*(lambda*x/beta)^i,i,0,n-1);
P_HO=symsum(factorial(8)/(factorial(i)*factorial(8-i))*(P_cond^i)*(1-P_cond)^(8-i),i,5,8);
P_HOt=double(int(fx*P_HO,x,0,inf))
What i like to calculate is last term of above code.
But there is some strange error.
(Error:DOUBLE cannot convert the input expression into a double array If the input expression contains a symbolic variable, use VPA. 오류 발생: sym/double (line 588) Xstr = mupadmex('symobj::double', S.s,0);)
When i set 'lambda = 1', above code doesn`t show me error.
But when purely run above code, error occurs.
I don`t know what is wrong.
Thank you!

 采纳的回答

When that happens, the meaning is that it was not able to find a numeric integral for the expression.
When I plot the expression, I find that it is all fairly small (or extremely small) values, except between about 1.3E-7 and 9.0E-7, with the peak at about 3.5559578143593540162E-7 where it reaches about 85885.334826. It is essentially not worth integrating outside that range. The overall integral marginally exceeds 0.0106219
You could use matlabFunction() to convert the symbolic expression to a function handle, and then use integral() on that. However, if you integrate much further out than 0 to 0.01 then it will not notice the hump near 1E-7 and will give you a totally inaccurate answer.

1 个评论

Finally i find that above integral`s success depends on scale of lambda.
And above integral result is independent to lambda value.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by