I want to calculate a function p of x,y: p(x,y) which is defined by the integral of another function of x and y:
p(x,y) = Integral(indefinite) of v(x,y) dx
Now, if I have a matrix expressing p
on a uniform grid x
and y
, how do I construct the function p
(which should be a matrix).
Obviously if I integrated using trapz
, I would obtain a vector:
x=linspace(-1,1,10); v=magic(10);
p=trapz(x,v);
size(p)
gives 1 10
and not 10 10.