plot 3D point data
조회 수: 19 (최근 30일)
이전 댓글 표시
채택된 답변
Rik
2018년 11월 23일
편집: Rik
2018년 11월 23일
You should be able to use the surf function. The only problem you have is interpolating the data to a normal grid that surf understands (and fill the rest with NaN).
The code below assumes your text file is stored in a 2112 by 3 array named data
x=data(:,1);
y=data(:,2);
z=data(:,3);
SamplePerDim=500;
X=linspace(min(x),max(x),SamplePerDim);
Y=linspace(min(y),max(y),SamplePerDim);
[X,Y]=ndgrid(X,Y);
F=scatteredInterpolant(x,y,z,'linear','none');
Z=F(X,Y);
figure(1),clf(1)
surf(X,Y,Z,'EdgeColor','none')
view(-160,80)
댓글 수: 4
Rik
2018년 11월 24일
As always, you're welcome.
I don't really know how to pick the resolution automatically. That will depend on the smoothness of your data and how much data you have. Ideally you would 2000, but that makes the plot very slow. You could use a fancy formula to estimate the best value, but because that is tricky I chose to hard code the value.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!