function u = pressure(xx,h,x0,k,N,v,x) % % function u = pressure(xx,h,x0,k,N,v,x) % % This function evaluates the representation formula (2.32) in the notes by % a simple boundary element discretisation, as described in question 5 of % the problem sheet. % % On entry: % % xx is an N x 2 matrix, the jth row of xx containing the position % vector of the collocation point in the jth element % h is an N x 1 vector, the jth entry of h the length of the jth % element % x0 is a 1x2 vector, the position vector of the point source of sound % k is the wavenumber % N is the number of boundary elements % v is an N x 1 (complex) vector, the jth element of v an approximation to the normal % derivative of the pressure (in the direction pointing into the domain) on % element j % x is a 2x1 vector, the position vector of the point at which the % pressure is required % % On exit: % % u is an approximation to the pressure at x % u = G(x0,x,k); for j = 1:N u = u + v(j)*h(j)*G(xx(j,:),x,k); end