
Re: numerical integration
Posted:
Mar 20, 2014 4:12 PM


Milad <hs597823@dal.ca> wrote in message <bfKdnTElz7ow15_OnZ2dnUVZ_qSdnZ2d@giganews.com>... > Suppose you want to integrate a function from (0,n), where n is matrix 2*2 and you have a function of x example: y=sin(x), > what is the command in matlab to compute the integral for each variable separately. > to end up with results like matrix:[y1,1 y1,2; y2,1,y2,2] > thanks >
>> f = @(n)integral(@sin,0,n) f = @(n)integral(@sin,0,n) >> arrayfun(f,[1,2;3,4]) ans = 0.459697694131860 1.416146836547142 1.989992496600445 1.653643620863612

