Contour Graph NOT Circular

1 Ansicht (letzte 30 Tage)
Amanda
Amanda am 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

Akzeptierte Antwort

Image Analyst
Image Analyst am 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]);
  1 Kommentar
Amanda
Amanda am 27 Aug. 2012
Yes -- Thanks for the help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by