FIND AREA SURFACE-PROBLEM IN MY CODE

1 view (last 30 days)
syms u v;
x = (1-u).*(3+cos(v)).*cos(pi*u);
y = (1-u).*(3+cos(v)).*sin(pi*u);
z = 8*u+( 1-u ).*sin(v);
% Find Area Surface
F=[x,y,z];
F=[x,y,z];
ru=diff(F,u);
rv=diff(F,v);
ruxrv=[ru(2).*rv(3)-ru(3).*rv(2),ru(3).*rv(1)-ru(1).*rv(3),ru(1).*rv(2)-ru(2).*rv(1)];
Mruxrv=sqrt(ruxrv(1).^2+ruxrv(2).^2+ruxrv(3).^2)
Aresurface=quad2d(Mruxrv,0,1,0,2*pi)

Accepted Answer

bym
bym on 26 Dec 2011
the function is called
dblquad()
and requires a function to be passed to it like:
f = matlabFunction(Mruxrv);
Aresurface=dblquad(f,0,1,0,2*pi)
Aresurface =
27.5280
  3 Comments
Walter Roberson
Walter Roberson on 26 Dec 2011
quad2d is also a function to consider.
http://www.mathworks.com/help/techdoc/ref/quad2d.html
dblquad() offers a choice of quadrature methods, and expects that the function be vectorized in x and scalar in y
quad2d() does not offer flexibility. It expects that the function accepts 2D arrays for x and y.
For both integrators, there is a potential vulnerability in the matter of whether matlabFunction returns a vectorized function or not. It is documented that if matlabFunction is used to write to a file, that the file it produces will be optimized code that can accept scalar or matrix arguments, but it is not made explicit as to what arguments are accepted if writing to a file is not done, and it is not made explicit that the matrix arguments will be processed element-wise.
justin  Taylor
justin Taylor on 26 Dec 2011
Oh ! thanhks I already understand ! ...

Sign in to comment.

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!