*Problem Find area surface *

x = ( 1-u )(3+cos v)cos(2pi*u)
y = ( 1-u )(3+cos v)sin(2pi*u)
z = 4u + ( 1-u )sinv.
D={(u,v)|0<=u<=1,0<=v<=2pi}
mycode
{ 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);
F=[x,y,z];
ru=diff(F,[u]);
rv=diff(F,[v]);
ruv=ru.*rv;
druv=sqrt(ruv(1).^2+ruv(2).^2+ruv(3).^2);
S=int(int(druv,u,0,1),v,0,2*pi)
}

 Risposta accettata

bym
bym il 18 Dic 2011
you are going to need:
a =feval(symengine,'linalg::crossProduct',ru,rv)% .* is not cross product!
b =feval(symengine,'norm',a,2)
once you get the integrand (b) then I would suggest you evaluate it numerically rather than symbolically. You can use
MatlabFunction()
to turn it into a function to pass to
dblquad

7 Commenti

justin  Taylor
justin Taylor il 19 Dic 2011
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];
ru=diff(F,u);
rv=diff(F,v);
rurv=feval(symengine,'linalg::crossProduct',ru,rv);% .* Khong can dau .
ds= feval(symengine,'norm',rurv,2);
a=int(ds,u,0,1/2);
f=inline('a')
S=subs(f,2*pi)-subs(a,0)
% Plot .
n = 50;
[u,v] = meshgrid(linspace(0,1,n),linspace(0,2*pi,n));
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);
surf(x,y,z)
Walter Roberson
Walter Roberson il 19 Dic 2011
You cannot subs() in to an inline function, only in to a symbolic variable.
On the other hand, inline('a') is just going to be a routine that takes a single parameter and returns it, since inline('a') passes the literal string 'a' to inline() rather than passing the value of a. But inline(a) is not going to work either, as inline() cannot be applied to symbolic objects.
You never use S after you calculate it, so there would not seem to be any point in calculating it, and thus no point in calculating f or a or ds or rurv or rv or F.
justin  Taylor
justin Taylor il 19 Dic 2011
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
F=[x,y,z];
ru=diff(F,u);
rv=diff(F,v);
rurv=feval(symengine,'linalg::crossProduct',ru,rv);% .* Khong can dau .
ds= feval(symengine,'norm',rurv,2);
S=int(int(ds,u,0,1/2),v,0,1);
justin  Taylor
justin Taylor il 19 Dic 2011
What proplem i meet ?
Walter Roberson
Walter Roberson il 19 Dic 2011
The dot product produces a single expression as its result, not a vector.
norm() must be applied to a matrix, a vector, a polynomial (which is a specific MuPad data type), or a "polynomial expression" (which is an expression in which the variables only enter in terms with integer exponents.) As indicated above, rurv is not a matrix or vector, and it was not constructed as a MuPad polynomial data type, so the only possibility left is a polynomial expression. The dot product, rurv, however, has many sin() and cos() terms involving the variables, so it is not a polynomial expression. Thus, norm() cannot be applied to it. See http://www.mathworks.com/help/toolbox/mupad/stdlib/norm.html
bym
bym il 19 Dic 2011
the expression is for the _cross_ product not _dot_ product.
Walter Roberson
Walter Roberson il 20 Dic 2011
Some day I will learn, "Never feed them after Midnight". ;-)

Accedi per commentare.

Più risposte (0)

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!

Translated by