Info

# how can i make my scattered 3 dimensional data points as a 3d surface?

1 view (last 30 days)
Ranjini Anbu on 27 Jan 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I am having the matrix k where each row represents a 3dimensional point.Each column of the matrix represents the respective dimensional value of each point.How can i make the 3d surface for the matrix?Kindly need help as soon as possible. >> k
k =
1.0e+03 *
0.0124 8.6000 0.0308
0.0099 9.8400 0.0355
0.0108 8.3200 0.0347
0.0118 8.0800 0.0490
0.0127 8.5800 0.0327
0.0133 7.8600 0.0438
0.0141 8.1600 0.0322
0.0102 8.1800 0.0490
0.0101 8.6800 0.0322
0.0134 8.1000 0.0372
0.0134 8.3000 0.0338
0.0130 7.3600 0.0550
0.0137 7.1200 0.0323
0.0096 9.1200 0.0372
0.0179 7.4800 0.0283
0.0100 8.4900 0.0372

Alessandro Masullo on 27 Jan 2015
tri = delaunay(k(:,1),k(:,2));
trisurf(tri,k(:,1),k(:,2),k(:,3))
##### 2 CommentsShowHide 1 older comment
Alessandro Masullo on 5 Feb 2015
The surface in your image is provided on a regular grid, while your data are not. You need to interpolate your data on a structured grid (created with meshgrid) using scatteredInterpolant.
k = 1.0e+03 *[ 0.0124 8.6000 0.0308
0.0099 9.8400 0.0355
0.0108 8.3200 0.0347
0.0118 8.0800 0.0490
0.0127 8.5800 0.0327
0.0133 7.8600 0.0438
0.0141 8.1600 0.0322
0.0102 8.1800 0.0490
0.0101 8.6800 0.0322
0.0134 8.1000 0.0372
0.0134 8.3000 0.0338
0.0130 7.3600 0.0550
0.0137 7.1200 0.0323
0.0096 9.1200 0.0372
0.0179 7.4800 0.0283
0.0100 8.4900 0.0372];
f = scatteredInterpolant(k(:,1),k(:,2),k(:,3),'natural','linear');
[x,y] = meshgrid(linspace(min(k(:,1)),max(k(:,1)),50),linspace(min(k(:,2)),max(k(:,2)),50));
z = f(x,y);
figure
surf(x,y,z)

### Community Treasure Hunt

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

Start Hunting!