Contour Graph NOT Circular

1 view (last 30 days)
Amanda
Amanda on 27 Aug 2012
I'm trying get a basic circular temperature contour graph.
Instead, I'm getting a straight line and doesn't resemble at all to
MATLAB's examples for contour maps. I want 4 circular zones
representing 90 degrees, 80 degrees, 70 degrees, and 60 degrees.
Here is my code:
long = [0 1 2 3; 4 5 6 7; 8 9 10 11; 12 13 14 15];
lat = [15 16 17 18; 19 20 21 22; 23 24 25 26; 27 28 29 30];
temp = [98 95 94 92; 85 82 81 80; 72 75 74 71; 65 62 61 69];
figure;
contour(long,lat,temp,4)
Thanks,
Amanda

Accepted Answer

Image Analyst
Image Analyst on 27 Aug 2012
You mean something like this?
clc; % Clear the command window.
workspace; % Make sure the workspace panel is showing.
format longg;
format compact;
fontSize = 20;
angularZones = 16;
radialZones = 10;
r = (0: radialZones)'/ radialZones;
theta = 2*pi*(-angularZones : angularZones) / angularZones;
X = r*cos(theta);
Y = r*sin(theta);
% Make up some random temperatures.
for rr = 1 : length(r)
for aa = 1 : length(theta)
temperatures(rr, aa) = 9*rr + rand;
end
end
pcolor(X,Y, temperatures)
axis equal tight
colorbar
grid on;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
title('Temperatures', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!