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

23 views (last 30 days)

Show older comments

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 Comments

### Answers (3)

Star Strider
on 7 Jun 2017

If you have three vectors, ‘x’, ‘y’, and ‘T’, first see if scatter3 will plot your data correctly.

If you want to interpolate it, since you have triangulated data, see if scatteredInterpolant (link) will do what you want.

##### 0 Comments

KSSV
on 7 Jun 2017

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 Comments

KSSV
on 7 Jun 2017

Edited: KSSV
on 7 Jun 2017

Try this file exchange: https://in.mathworks.com/matlabcentral/fileexchange/32029-plate-bending?focused=5205542&tab=function

It is easy,to achieve what you said. You are confused.

Precise Simulation
on 7 Aug 2017

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!