Plotting 2 Matrices

조회 수: 2 (최근 30일)
Joe J
Joe J 2012년 4월 12일
Hi,
I'm having difficulty constructing a plot. I have two 2D matrices of the same size, matrix one contains elevation data (a cross section of a 3D matrix), matrix two contains attribute data of the same points contained in matrix one. I'm trying to construct a plot that preserves the elevation data and does a color shading based on the attribute values contained in matrix two.
I plot matrix one with using the following: for n = 1:300 plot(matrix one(n,:)) hold on end
This produces a plot with a series of cross sections stacked on top of each other. I'd like to preserve the appearance of this plot while shading it using the values in matrix two. Basically, I want the position of a point to be based on it's value in matrix one and the color based on it's value in matrix two. I hope I've explained this clearly enough. I'd appreciate any help.
Thanks.

답변 (1개)

Honglei Chen
Honglei Chen 2012년 4월 12일
You can try
surf(matrix1,matrix2)
and see if that's what you want.
  댓글 수: 2
Joe J
Joe J 2012년 4월 13일
Thanks for the response. I tried your suggestion and it doesn't give me what I'm looking for. To restate what I'm trying to do, I have two matrices, matrix1 contains elevation data. Every row in matrix1 is a cross section of a 3D surface. When I plot matrix one it gives me a bunch of lines, one on top of the other, representing surface elevations at different time steps in the model.
Matrix2 is the same size as matrix1 and contains numerical attribute data for each cell in matrix1. I basically want to plot matrix1 and perform a color shading based on matrix2.
laurie
laurie 2012년 4월 13일
pcolor(matrix2) can do a color shading, but I don't know about the 3D aspect of your problem..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by