MATLAB: Integration of a function from R^1 to R^n

integralintegrationMATLABmultiplenumerical integrationvariables

I have calculate the integral of a function.
This is a simple task: The function quad works fine for function from R^1 to R^1, and quad2 for R^2 to R^1 functions.
however, a way to calculate a simple R^1 to R^n functions does not exist! To be clear, i mean domain R^1 and range R^n, like a curve, for example.
I will appreciate any help!!!

Best Answer

The integral of a vector-valued function is vector-valued. You simply integrate each component. This can be done with QUADV or with INTEGRAL (new function in R2012a) using the 'ArrayValued' option set to true.
>> F = @(x)[x,sin(x),tan(x),log(x),exp(x)]
F =
@(x)[x,sin(x),tan(x),log(x),exp(x)]
>> integral(F,0,1,'ArrayValued',true)
ans =
0.5000 0.4597 0.6156 -1.0000 1.7183
>> quadv(F,0,1)
ans =
0.5000 0.4597 0.6156 -1.0000 1.7183
Did you want to calculate arc length or something else instead? -- Mike