MATLAB: Temperature distribution contour plot

3d plotsbicubicalcontourgriddatameshscattered datatemperature distribution

I want to create a contour plot,like above, of a plate with temperatures at specific points on the plate. The data should be interpolated bicubical. Now i have just a few points on my plate but wanted the contour and so the interpolated data over the full size of the plate is this possible?
Below you can find some example data with x- and y-coordinates and also some temperatures corresponding to the coordinates.
X_Plate=200; % length mm
Y_Plate=400; % heigth mm
x=[-80 -50 0 50 60]; % x-coordinates
y=[-150 -100 0 100 130]; % y-coordinates
T=[15 20 30 10 5]; % Temperature °C
% the coordinate system has its origin in the center of the plate
I would be very pleased if someone could help me.

Best Answer

In order to create a contour plot, you will need to have a temperature measurement for each (x,y) permutation. This means T needs to be a matrix with the same number of rows as there are values in y, and the same number of columns as there are values in x. The column and row indices of T are the x and y coordinates in the plane, respectively.
x=[-80 -50 0 50 60]; % x-coordinates
y=[-150 -100 0 100 130]; % y-coordinates
T=[15 20 30 10 5]; % Temperature °C
z=ones(5,1)*T
z = 5×5
15 20 30 10 5 15 20 30 10 5 15 20 30 10 5 15 20 30 10 5 15 20 30 10 5
contourf(x,y,z)
Related Question