matlab - Function defined as an integral: trapz? -


i want calculate function p of x,y: p(x,y) defined integral of function of x , y:

p(x,y) = integral(indefinite) of v(x,y) dx

now, if have matrix expressing p on uniform grid x , y, how construct function p (which should matrix).

obviously if integrated using trapz, obtain vector:

x=linspace(-1,1,10); v=magic(10); p=trapz(x,v); size(p) 

gives 1 10 , not 10 10.

assuming that

  1. the formula p defined like:

p(x,y) = integral[x0 .. x] v(ξ,y) dξ;

  1. the integration grid x × y uniform, norm dx × dy;

  2. the rows of matrix v have x constant, first row corresponding the smallest x;

then integral is:

p = cumtrapz(v) * dx; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -