Surface Plot in Matlab (Cylindrical Coordinates)

Click For Summary
SUMMARY

The discussion focuses on plotting the steady-state temperature solution equation u(r,z) in cylindrical coordinates using MATLAB. The equation is defined as u(r,z) = u_0 * sinh(λz) * J_0(λr), with r ranging from 0 to 2 and z from 0 to 4. The solution is independent of the θ coordinate, allowing for a 3D surface plot by transforming r into Cartesian coordinates (x, y) using r = √(x² + y²). Users are advised to create fine grids for x and y to ensure a smooth surface representation.

PREREQUISITES
  • Understanding of cylindrical coordinates and their application in MATLAB.
  • Familiarity with the MATLAB functions sinh() and J0() for mathematical computations.
  • Knowledge of 3D plotting techniques in MATLAB.
  • Basic understanding of grid generation in MATLAB for surface plots.
NEXT STEPS
  • Learn how to use MATLAB's meshgrid function for creating 3D plots.
  • Explore MATLAB's surf() function for visualizing surface plots.
  • Study the implementation of Bessel functions in MATLAB for advanced plotting.
  • Investigate techniques for optimizing grid resolution in MATLAB for smoother surfaces.
USEFUL FOR

Mathematics and engineering students, MATLAB users, and researchers working on thermal analysis and surface plotting in cylindrical coordinates.

phioder
Messages
25
Reaction score
0
Hello

Trying to plot in MATLAB the final solution equation u(r,z) of the steady state temperatures in the circular cylinder

u(r,z) is defined in cylindrical coordinates and I'm confused trying to understand also how MATLAB plots a mesh.

After some simplification The final solution looks like:

u(r,z) = u_0 \cdot sinh(\lambda z) \cdot J_0(\lambda r)

and it is defined in

0<r<2

0<z<4

\lambda = constant

The solution of the problem is not defined in \theta and most of 3d plot examples I have found yet on the web define a theta vector.

In MATLAB a one dimensional linspace vector for r, one for z is defined and later evaluated with sinh() and J0(). The resulting vector are multiplied as sinh().*J0(), to get again a one dimensional vector, all vectors are of the same size, so I suppose the vectors are right.

Now the question is, is it possible to display u(x,t) as a surface with Matlab? If yes, could anyone give me some kind of tip, hint on how to implement and understand the plot?

Best Regards and Thank you
 
Last edited:
Physics news on Phys.org
The solution is indepeendent of \theta, so it doesn't matter, I'd set r = \sqrt{x^2+y^2} and plot in 3-d on that grid. Make x and y on a fine enough grid that you can get a bunch of points for a smooth surface.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
7
Views
3K