How to plot a function which is in cylindrical coordinates - A 3D plot?
9 views (last 30 days)
Show older comments
aneps
on 26 May 2015
Commented: Walter Roberson
on 27 May 2015
I am learning about traps in physics. I want to plot the following function on Matlab to visualize (A 3D plot):
F(r,z) = k/2 (z^2 - r^2/2) + k/2 * R^2 * ln(r/R) + C
This is in cylindrical coordinates. Let us take constants k=1, R=1 and C=1.
After plotting this, I want to plot one more thing,
z(r) = [r^2/2 - R^2/2 + R^2 *ln(R/2)]^0.5.
My aim is to visualize F(r,z) and z(r).
These equations are related to an ion trap mass spectrometer called Orbitrap.
0 Comments
Accepted Answer
Walter Roberson
on 26 May 2015
If you are willing to work inside a MuPAD notebook, then you could use Plot::Cylinder. I do not know if those plots can be exported as MATLAB objects.
Otherwise, use pol2cart() on your [theta,r] coordinates to get [x,y] coordinates, and then use your defined z for the z coordinate.
2 Comments
Walter Roberson
on 27 May 2015
MuPAD is the formal name of the Symbolic Toolkit implementation. When you have that toolkit installed there are a number of interface routines that take care of communicating with MuPAD automatically, but from time to time in order to access functionality there is no interface for, you need to
evalin(symengine, 'MUPAD COMMAND STRING');
I have never had access to the MuPAD version of the Symbolic Toolkit (I used to have the Maple based Symbolic Toolkit), so one of the things I do not know is whether you can call upon the MuPAD graphics from MATLAB using evalin() or feval(). Possibly you would just get back the graphics data structure without it being drawn. (MuPAD plots are represented as data structures that can be manipulated as data, with the user interface having special rules about how to display those kinds of data structures.)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!