KevinKim
KevinKim

Reputation: 1434

plot curves that are described by a matrix in matlab

I have a matrix, where the row is generated by X = [0:0.01:10] and the column is generated by Y = [20:-0.01:5] The numbers in the matrix are either 0, 1 or 9 which partitions the matrix in to 3 distinct regions. I want to generate a XYplot such that it draws the boundaries of these regions that are captured by the numbers in the matrix.

Is there a clever way of achieving this goal in matlab?

Upvotes: 0

Views: 22

Answers (1)

chthonicdaemon
chthonicdaemon

Reputation: 19770

Yes, you can use contour and specify the levels on which to draw contours. In your case you want to draw a line on the 1 and 9 values.

contour(X, Y, thematrix, [1, 9])

where thematrix is the name of your matrix.

Upvotes: 1

Related Questions