Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Plot vectors in polar coordinates

1,289 views
Skip to first unread message

Red Star

unread,
Jun 28, 2008, 8:59:33 AM6/28/08
to
I have a field. I created that by [x,y]=meshgrid(..).
I have a vector in polar coordinates u=[u_r u_az].
I would plot my vector.
In cartesian coordinates I'd use
quiver(x,v,v_x,v_y)
but I have a vector definied in polar coordinates now.
I'd not change the coordinate system, because it could be too
laborious
How can I do?

Thanks

Scott Burnside

unread,
Jun 28, 2008, 10:23:01 AM6/28/08
to
Red Star <matteo.d...@gmail.com> wrote in message
<ae9d543f-b29a-4ba8-a293-
153885...@79g2000hsk.googlegroups.com>...

pol2cart

Élodie

unread,
Jun 28, 2008, 1:00:57 PM6/28/08
to
» help polar

POLAR Polar coordinate plot.
POLAR(THETA, RHO) makes a plot using polar coordinates of
the angle THETA, in radians, versus the radius RHO.
POLAR(THETA,RHO,S) uses the linestyle specified in string S.
See PLOT for a description of legal linestyles.

See also PLOT, LOGLOG, SEMILOGX, SEMILOGY.


Red Star

unread,
Jun 28, 2008, 1:09:16 PM6/28/08
to
pol3cart change u=[u_radial u_azimutal] to v=[vx vy] and then I can
do quiver(x,y,vx,vy)?

Elodie...POLAR is not the right command

dpb

unread,
Jun 28, 2008, 1:46:07 PM6/28/08
to
Red Star wrote:
> pol3cart change u=[u_radial u_azimutal] to v=[vx vy] and then I can
> do quiver(x,y,vx,vy)?

Give it a go...what's to lose?

You can also look at the source to quiver.m and see what it would take
to add a polar option to it.

Look for user-contributed stuff on TMW site as well...

--

Red Star

unread,
Jun 28, 2008, 5:00:45 PM6/28/08
to

I hoped to find a method.
pol2car can't work: if u_radial=0 and u_azimuthal=any (a vortex for
example).....the function gives always vx=0 vy=0 of course

dpb

unread,
Jun 28, 2008, 6:58:37 PM6/28/08
to
Red Star wrote:
...

> I hoped to find a method.
> pol2car can't work: if u_radial=0 and u_azimuthal=any (a vortex for
> example).....the function gives always vx=0 vy=0 of course

Well, we don't always get what we wish for... :)

Did you look on TMW file exchange?

--

Alex

unread,
Nov 14, 2012, 7:19:06 AM11/14/12
to
Use a rotation matrix ;)

xL = linspace(-4, 4, N);
yL = linspace(-4, 4, N);
[x y] = meshgrid(xL, yL);
ro = sqrt(x.*x + y.*y);
teta = atan2(y, x);

% Velocity in polar
vr = Vinf * (1-(R./ro).^2) .* cos(teta);
vt = -Vinf * (1+(R./ro).^2) .* sin(teta);

% Rotation
u = vr .* cos(teta) - vt.*sin(teta);
v = vr .* sin(teta) + vt.*cos(teta);

quiver(x,y,u,v)
0 new messages