How to plot a surface-like plot when the data is not regularly spaced
조회 수: 1 (최근 30일)
이전 댓글 표시
I have 3-d data, where first two columns (x,y) are independent and the third column (z) is dependent upon first two. I want to have a surface plot of the data so that I can see what region in (x,y) space gives low values of z and what region gives high values of z. But I am not able to use a surface plot because the data is not regularly spaced as required for using 'surf'. I have attached the mat-file containing three columns for reference. Is there a good way of solving this problem?
댓글 수: 0
채택된 답변
Michal Dobai
2017년 12월 12일
편집: Michal Dobai
2017년 12월 12일
How about this?
[xi,yi] = meshgrid(0:0.01:10, 0:0.01:10);
zi = griddata(demodata(:,1),demodata(:,2),demodata(:,3),xi,yi);
handle = surf(xi,yi,zi, 'EdgeColor', 'none');
% I adjusted color limits for better-looking plot of your data
handle.Parent.CLim = [-100 -80];
Result plot:
Is this what you need?
댓글 수: 4
Les Beckham
2017년 12월 13일
If you have to deal with smoothing out noise in the data, or extrapolating beyond the edges of your grid, you might want to take a look at John D'Errico's excellent File Exchange submission gridfit.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!