Clear Filters
Clear Filters

Matlab's curl function and its limitation?

7 views (last 30 days)
Rizwana
Rizwana on 17 Feb 2014
Commented: John D'Errico on 5 Sep 2014
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

Answers (1)

Alberto
Alberto on 5 Sep 2014
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 Comment
John D'Errico
John D'Errico on 5 Sep 2014
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?

Sign in to comment.

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!