help-octave
[Top][All Lists]

## Re: Help Plotting Symbolic Vector Fields with Substitutions

 From: WARDEVIL_UFO Subject: Re: Help Plotting Symbolic Vector Fields with Substitutions Date: Tue, 18 Apr 2017 18:23:35 -0700 (PDT)

```Hi Mike, and everyone!  After some more hours of digging, and putting puzzle
pieces together, one by one, I was able to  construct another way!It looks
like the key to converting a symbolic function to a form that is usable by
quiver3 is by using function_handle() or equivalently, matlabFunction().  My
corrected code is below:

clear

syms x y z

phi = atan2(y,x);

r = sqrt(x.^2+y.^2);

trans = [cos(phi), -sin(phi), 0; sin(phi), cos(phi), 0; phi.*0, 0, 1];

cyl = [z ./ r;r; r.^2.*z];

#cyl = [1 ./ r;0; 0];

rec = trans * cyl;

u = matlabFunction(rec(1,1));

v = matlabFunction(rec(2,1));

w = matlabFunction(rec(3,1));

[X,Y,Z] = meshgrid([-1:.5:1]);

figure

quiver3(X,Y,Z,u(X,Y,Z),v(X,Y,Z),w(X,Y,Z))

--
View this message in context:
http://octave.1599824.n4.nabble.com/Help-Plotting-Symbolic-Vector-Fields-with-Substitutions-tp4682904p4682912.html
Sent from the Octave - General mailing list archive at Nabble.com.

```