How to solve an integral with symbolic values as borders in another integral?
    5 views (last 30 days)
  
       Show older comments
    
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?
0 Comments
Accepted Answer
  Torsten
      
      
 on 14 Jun 2018
        
      Edited: Torsten
      
      
 on 14 Jun 2018
  
      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.
More Answers (0)
See Also
Categories
				Find more on Assumptions in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
