*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)
}

 채택된 답변

bym
bym 2011년 12월 18일

0 개 추천

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

justin  Taylor
justin Taylor 2011년 12월 19일
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 2011년 12월 19일
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 2011년 12월 19일
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 2011년 12월 19일
What proplem i meet ?
Walter Roberson
Walter Roberson 2011년 12월 19일
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 2011년 12월 19일
the expression is for the _cross_ product not _dot_ product.
Walter Roberson
Walter Roberson 2011년 12월 20일
Some day I will learn, "Never feed them after Midnight". ;-)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

질문:

2011년 12월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by