MATLAB: How to estimate/evaluate the integral of a constant value function

integralintegrationnumerical integration

For example, f = 5, for 0<t<1, zero otherwise.
i tried the following code but it didn't work:
syms t
f = 10;
int(f)

Best Answer

syms t a b real
f = piecewise(0 < t & t < 1, 5, 0)
f = 
int(f, t, a, b)
Warning: Unable to check whether the integrand exists everywhere on the integration interval.
ans =