How to plot temperature distribution T(X,Y) over a 2D rectangular plate in Matlab?

Hi all,
I recently attempted to code the FEM 2D triangular element method to solve for the temperature at each node of a rectangular plate with given temperature boundary conditions. I successfully assigned the (x,y) coordinates at each node and solved the corresponding temperature at each node. By the way, the temperature is a vector. Now I would like to know how to plot a temperature distribution for the reactangular plate in Matlab. I've attempted to use surfc(x,y,T); however, Matlab returned an error that states "T needs to have more than one row or column." I appreaciate for any help provided.

4 commentaires

How is T a vector? Let's take a look at the 100th element of T. How are we, or MATLAB, supposed to know what (row, column) or (y, x) element 100 is supposed to be at? Turn T into a 2-D array, then use imshow() to display it.
I'm sort of confused, why do I want to turn T into a 2D array when there's only one temperature at each node?
Maybe you can show a diagram. I thought you had "a rectangular plate" and to me, that means a 2-D situation where for every (x,y) location you have a temperature. I'm not sure what your "nodes" are. I'm thinking that, for example a point 2 mm over and 4 mm down from the upper left corner should have a temperature. And likewise for every location in the rectangular plate. I thought you said that every node has an (x,y) coordinate. Apparently that's not what you are envisioning, so you'll have to explain better, like with diagrams or pictures of this rectangular plate with the where these one-D Temperatures are located on that rectangular plate.
Jin Au
Jin Au le 7 Juin 2017
Modifié(e) : Jin Au le 7 Juin 2017
I apologize for my unclear description. Here's the diagram of the problem.

Connectez-vous pour commenter.

Réponses (3)

You said FEM....and triangular elements....so you have used unstructured grid. You should be having (x,y) points in the form of nX2 array and nodal connectivity data (say tri)in the form of nX3 array. So you have evaluated temperature T at each node; this is nX1 array, where n is the number of nodes. You can plot this using: trisurf
trisurf(tri,x,y,T)
doc triplot, trimesh , trisurf .

6 commentaires

Hi, I've tried your suggestion, but it wasn;t particularly the figure I want. I believe that the answer I'm seeking is a display of the 2D temperature contour plot over the rectangular plate. Something similar to this picture. Thanks for the help.
KSSV
KSSV le 7 Juin 2017
Modifié(e) : KSSV le 7 Juin 2017
Attach the data you have....You said rectangular plate..but plate is circular here, with a hole at the center.
I'm so sorry for being unclear. I mean a 2D temperature contour plot of a rectangular plate without the hole.
Here's the figure that displays my nodal connectivity.
Also, here's the Matlab code if you are interested in taking a look.
KSSV
KSSV le 7 Juin 2017
Modifié(e) : KSSV le 7 Juin 2017
It is easy,to achieve what you said. You are confused.

Connectez-vous pour commenter.

You can use the FEATool FEM toolbox and postprocessing function to plot unstructured FEM data on triangulated grids and meshes as described in the linked tutorial post.

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by