Filter löschen
Filter löschen

A "discrete" contour plot

5 Ansichten (letzte 30 Tage)
Brooke
Brooke am 15 Apr. 2012
If M(i,j) is a matrix,
How might I plot a contour plot where the (i,j) point on the x,y-plane has altitude M(i,j)?
What I did was
  x = 1:1:imax;
y = 1:1:jmax;
 
[x,y] = meshgrid(x,y);
z=M;
[c,h] = contour(x,y,z,100);
clabel(c,h,'manual');
But it doesn't seem to be right…
(If the plotting bit is right, then there must be something else the wrong with the program!)
  1 Kommentar
Walter Roberson
Walter Roberson am 15 Apr. 2012
It isn't a good idea to overwrite x and y with meshgrid(x,y), in the sense that it is confusing to the reader.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Wayne King
Wayne King am 15 Apr. 2012
When you say "discrete" contour plot, do you mean something like
z = abs(round(peaks(5)));
bar3(z,0.3);
  1 Kommentar
Brooke
Brooke am 15 Apr. 2012
@Wayne: No, I just meant that the "data points" are given at discrete points. Sorry about the ambiguity... Nice bar chart, btw.

Melden Sie sich an, um zu kommentieren.

Kategorien

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

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by