MATLAB: Numerical integration with variable limits

double integralnumerical integrationvariable limits

Hi,
I am essentially trying to code the calculation in the attached photo. It feels like a rather simple computation but I have not succeeded using either the integral or integral2 functions.
L, TP, T, w, a, AL and epsilon are all just values with x and y being the parameters to integrate over.
Can anybody help?
Thank you!

Best Answer

Probably,
%L, TP, T, w, a, AL, epsilon, all defined prior to next line
innerintegral = @(y) w * (epsilon + a*y).^AL * L / T;
integralx = @(x) integral(innerintegral, 0, x);
outterintegral = @(x) (x*L/TP) - integralx(x);
integral(outterintegral, 0, 1, 'ArrayValued', true)