- interpolate the values onto a grid, or
- fit a curve get gridded values and plot them.
How to fit a surface to 3D dta points
26 次查看(过去 30 天)
显示 更早的评论
回答(2 个)
Stephen23
2018-9-14
编辑:Stephen23
2018-9-14
Your data are scattered, not gridded:
surf only plots gridded data. To use surf you will either have to
Another option would be to use a Delaunay triangulation to plot the scattered data directly:
trisurf(delaunay(IM,Z50),IM,Z50,MnXdisp)
Gives:
This blog gives an nice explanation of options for scattered data:
2 个评论
Stephen23
2018-9-14
@Mos_bad: well, the data you gave us might have been gridded at some point in history, but is now missing many data points. If you have data then of course you can fit curves to it (if that has any meaning depends on the data and what it represents).
KSSV
2018-9-14
编辑:KSSV
2018-9-14
% Unstructred data plot
dt = delaunayTriangulation(IM,Z50) ;
t = dt.ConnectivityList ;
p = dt.Points ;
figure (1);
plot3(IM,Z50,MnXdisp,'b*');
hold on;
trisurf(t,p(:,1),p(:,2),MnXdisp')
title('unstructured')
% structured plot
x = IM ; y = Z50 ; z = MnXdisp ;
N = 50 ;
xi = linspace(min(x),max(x),N) ;
yi = linspace(min(y),max(y),N) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
figure (2);
plot3(IM,Z50,MnXdisp,'b*');
hold on;
surf(X,Y,Z)
title('structured')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!