3D visualization of this data

조회 수: 1 (최근 30일)
Mo Ba
Mo Ba 2017년 7월 24일
편집: Mo Ba 2017년 7월 24일
Hello, This is my data matrix in MATLAB:
43.676289 -79.477386 1
43.676370 -79.477107 5
43.676517 -79.477375 20
43.676417 -79.477509 8
43.676129 -79.477278 15
First column is Y axis, second column is X axis and third column is my data. How do I draw a bar graph and how to adjust the color of bars according to the value of data (like colorbar in surfe graph) for each data point in MATLAB? the problem is unit of XY axis is not compatible with Z, and this made me confused. I added an example graph which I drew for another data matrix. In this example X,Y,Z were linear and I could draw this graph using 'surf' command with no problem. I need to draw the same graph for mentioned data.

답변 (1개)

KSSV
KSSV 2017년 7월 24일
data = [ 43.676289 -79.477386 1
43.676370 -79.477107 5
43.676517 -79.477375 20
43.676417 -79.477509 8
43.676129 -79.477278 15];
y = data(:,1) ;
x = data(:,1) ;
z = data(:,3) ;
[X,Y] = meshgrid(x,y) ;
Z = repmat(z,1,size(X,1)) ;
surf(X,Y,Z)
colorbar
  댓글 수: 1
Mo Ba
Mo Ba 2017년 7월 24일
편집: Mo Ba 2017년 7월 24일
Thanks for answer. Please have a look at the result of your code. Unfortunately it doesn't make sense to me. there were a small mistake in your code that i fixed it. But still doesn't work as I need.
y = data(:,1) ;
x = data(:,2) ;
z = data(:,3) ;

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by