Reputation: 249
I calculate this integral.
integral(@(x) f, xmin, xmax);
At x = a, f(a) = constant
and the integral(@(x) constant, xmin, xmax)
returns errors.
So,
x = a
. Upvotes: 0
Views: 427
Reputation: 6424
this will solve the problem:
fun = @(x) 5;
integral(fun,0,1,'ArrayValued',true)
according to Mathworks: Array-valued function flag, specified as the comma-separated pair consisting of 'ArrayValued' and either false, true, 0, or 1. Set this flag to true when you want to integrate over an array-valued function. The shape of fun(x) can be a vector, matrix, or N-D array.
Example: 'ArrayValued',true indicates that the integrand is an array-valued function.
Upvotes: 1