MATLAB: I have an array of data I want to plot circular contour with those data

contourMATLAB

I got Temperature =
200.00
199.94
199.85
199.71
199.51
199.26
198.96
198.60
198.18
197.72
197.20
as a column matrix. Now I want to plot circular contour whose Z value will change radially with given temperature.
For example: at radius=1 all Z values will be 200; For radius=2 all Z value will be 199.94….so on..
How to do that?

Best Answer

Here is my solution
clc,clear
T = [200.00
199.94
199.85
199.71
199.51
199.26
198.96
198.60
198.18
197.72
197.20];
r = linspace(1,15,length(T));
t = linspace(0,2*pi,50);
%% SHORTER VERSION
[x,y] = pol2cart(t,1);
[Z,X] = meshgrid(T,x);
[~,Y] = meshgrid(T,y);
[R,~] = meshgrid(r,x);
subplot(121)
pcolor(R.*X,R.*Y,Z)
axis vis3d
%% MORE READABLE VERSION
[X,Y,Z] = deal( zeros(length(T),length(t)) );
for i = 1:size(X,1)
X(i,:) = r(i).*cos(t);
Y(i,:) = r(i).*sin(t);
Z(i,:) = T(i);
end
subplot(122)
pcolor(X,Y,Z)
axis vis3d