MATLAB: How to solve an integral with symbolic values as borders in another integral

integrationMATLABsymbolic

In my problem I have to evaluate the integral of a function with respect to x. However within that function is an integral with respect to variable h with borders from 0 to 56-x. To model this I used the following code.
if true
% code
end
scale = 0.00095
shape = 8.907
lambda = 0.00174
syms x h
func1 = @(x) (wblpdf(x,1/scale,shape))/(1-wblcdf(0,1/scale,shape));
func2 = @(x) expcdf(56-x,1/lambda);
f3 = int((1-wblcdf(56-x-h,1/scale,shape)),h,0,56-x);
func3 = matlabFunction(f3);
func4 = @(x) func1(x).*func2(x).*func3(x);
forecast = forecast + integral(func4,0,28);
end
If I try this I get the error message: Error using symengine. Unable to prove '56 – x – h < 0' literally. Use 'isAlways' to test the statement mathematically. I know that this has something to do with the variable of the weibullcdf having to be bigger than 0. How do I use isAlways to solve my error?

Best Answer

Use integral2:
scale = 0.00095;
shape = 8.907;
lambda = 0.00174;
func1 = @(x) (wblpdf(k_1t-tr+x,1/scale,shape))/(1-wblcdf(k_1t-tr,1/scale,shape));
func2 = @(x) expcdf(56-x,1/lambda);
func3 = @(x,y) 1-wblcdf(56-x-y,1/scale,shape);
fun = @(x,y)func1(x).*func2(x).*func3(x,y);
ymax = @(x) 56 - x;
q = integral2(fun,0,28,0,ymax)
Best wishes
Torsten.
Related Question