how to display a vector as colorplot of to other vectors

Hi, I couldn't figure that one out myself, so hopefully somebody has a solution.
I have three vectors X, Y, and Z of same dimension, so that Z(k) is a height for horizontal coordinates (X(k),Y(k)). I want to display Z as a color plot over the horizontal area that encompasses all coordinate pairs of X and Y. All functions I know (pcolor, surf, etc) require Z to be a matrix which is not really feasible due to memory problems since the vectors are quite large (appr. 250000 elements). Also, the horizontal coordinates are not on a regular grid but more like a point cloud.
Any idea how to display the data as it is would be appreciated.
Cheers, Peter

댓글 수: 3

Hi,
Can you please explain how Z(k) is the height for horizontal coordinates (X(k),Y(k))? I mean suppose Z(1) is height for (X(1),Y(1)), but then what is the height at (X(1),Y(2))? Is it still Z(1) or is it Z(2)?
Regards, Vaibhav
It's just a list of 3D points:
x1, y1, z1
x2, y2, z2
x3, y3, z3
etc.
xn, yn, zn
Each row is one point, though he has it in 3 different arrays: x, y, and z. You would never pair things from different rows - it doesn't make sense. So if you're looking at the 4th point, you would use x(4), y(4) to get the lateral location, and then z(4) to get the Z height. You would never use x(2) and y(37) because there is no point there. Does that make sense now?
Yes, thank you for explaining that. scatter3 or plot3 will work well in that case as suggested by Star Strider.
Another option might be to map values in z vector to RGB values and make a plot of each point with the corresponding color from z vector.

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

 채택된 답변

Star Strider
Star Strider 2016년 1월 13일

0 개 추천

If you have a point cloud, the scatter3 or plot3 functions would work. There are a number of options for coloring the points.
If you want to grid them at some point, see if scatteredInterpolant will do what you want.

댓글 수: 1

I was also going to suggest the same thing: first get a regular image with scatteredInterpolant(), then display with some normal display function like imshow(), surf(), or whatever. Some other cool visualization options are in the MATLAB Gallery: http://www.mathworks.com/products/matlab/plot-gallery.html

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

질문:

2016년 1월 13일

댓글:

2016년 1월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by