Matlab's curl function and its limitation?
3 次查看(过去 30 天)
显示 更早的评论
Iam beginner to matlab. Still learning it.Recently i have been asked to compute curl of three velocity components and plot its contour w.r.t circumferential angle along x-axis and radius along y-axis. The data u,v and w is pre-calculated by me as follows
u = V * Cos(beta) * cos(alpha); % V is velocity in m/s and alpha,beta are angles in radians
similarly
v = V * cos(beta) * sin(alpha);
w = V * sin(alpha)
Someone recently commented out saying that to enable mat lab's curl functionality my u,v and w data should be in Cartesian coordinate. I relied saying that though my initial data is in spherical coordinates(V,alpha,beta) but iam using coordinate conversion on u,v and w and transforming my data to Cartesian coordinate.
He further replied saying that "not only u,v,w should be Cartesian but its relative data x,y,z should also need to be Cartesian coordinate"
I dint get it. Can anyone say what he was trying to say or if i can use the curl functionality in matlab's.
(I further came across this Mupad interface page in matlab. Can someone please let e know if i can solve my problem using that/extending that interface)
I shall be grateful for your help and answer.
Thanks
0 个评论
回答(1 个)
Alberto
2014-9-5
yes you have to transform both velocity vector data and spherical coordinates (r,phi,theta) to Cartesian vector and coordinates.
For example if J(r,theta,phi) = Jr ar + Jtheta atheta + Jphi aphi is velocity vector and (ar, atheta, aphi) are unity vector, and also (r,phi,theta) are spherical coordinates, then:
Jx=(sin(theta).*cos(phi).*Jr)+(cos(theta).*cos(phi).*Jtheta)+(-sin(phi).*Jphi);
Jy=(sin(theta).*sin(phi).*Jr)+(cos(theta).*sin(phi).*Jtheta)+(cos(phi).*Jphi);
Jz=(cos(theta).*Jr)+(-sin(theta).*Jtheta);
x=r.*sin(theta).*cos(phi);
y=r.*sin(theta).*sin(phi);
z=r.*cos(theta);
1 个评论
John D'Errico
2014-9-5
Essentially, the function curl does not know what your numbers mean. Numbers are merely that. Only you can assign meaning to a set of coordinates. Are they angles or not?
Should we fear (just a bit) the day when a computer becomes smart enough to know what we want to do without our having to direct it?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!