Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. Longitude Latitude Value
  2. --------- -------- -----
  3. 12.345678 23.456789 25
  4. 12.345679 23.456790 26
  5. %should be :
  6. % x y z
  7.  
  8. surf(matrix(:,1) , matrix(:,2) , matrix(:,3));
  9.  
  10. Error using surf (line 75)
  11. Z must be a matrix, not a scalar or vector
  12.  
  13. x = matrix(:,1);
  14. y = matrix(:,2);
  15. z = matrix(:,3);
  16. xi=linspace(min(x),max(x),30)
  17. yi=linspace(min(y),max(y),30)
  18. [XI YI]=meshgrid(xi,yi);
  19. ZI = griddata(x,y,z,XI,YI);
  20. contourf(XI,YI,ZI)
  21.  
  22. xMin=min(myMat(:,1));
  23. xMax=max(myMat(:,1));
  24. yMin=min(myMat(:,2));
  25. yMax=max(myMat(:,2));
  26.  
  27. step_x=0.5; %depends on your data
  28.  
  29. [xGrid,yGrid]=meshgrid(xMin:step_x:xMax,yMin:step_y:yMax);
  30.  
  31. surf(xGrid,yGrid,valMat);
  32.  
  33. N=50;
  34. x = 2*pi*rand(N,1);
  35. y = 2*pi*rand(N,1);
  36. z = sin(x).*sin(y);
  37.  
  38. matrix = [x y z];
  39.  
  40. tri = delaunay(matrix(:,1),matrix(:,2));
  41. trisurf(tri,matrix(:,1),matrix(:,2),matrix(:,3))
  42. shading interp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement