Interpolate surface between 3D lines
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lars Gode
am 20 Aug. 2018
Kommentiert: Sanoop Siby
am 5 Mär. 2020
Hi all,
i have several 3D lines and i want to use them to create a surface between them.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194087/image.png)
In the image above you can see two of those lines as an example. The data used for those lines is in the attachment. Below you see the code i tried to use to create a surface between these two lines.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194088/image.png)
Unfortunately, it also created a surface between each of the lines itself.
Is there a way to create a surface just for the area between the two lines?
Thanks a lot !
y = [Data1(:,1); Data2(:,1)];
x = [Data1(:,2); Data2(:,2)];
z = [Data1(:,3); Data2(:,3)];
figure;
rangeX = -1500:10:0;
rangeY = 0:0.1:20;
[X,Y] = meshgrid(rangeX,rangeY);
Z=griddata(x,y,z,X,Y,'cubic');
surf(X,Y,Z)
hold on;
plot3(Data1(:,2),Data1(:,1),Data1(:,3),'LineWidth',2);
plot3(Data2(:,2),Data2(:,1),Data2(:,3),'LineWidth',2);
grid on
0 Kommentare
Akzeptierte Antwort
Mohammad Hukan
am 20 Aug. 2018
Bearbeitet: Mohammad Hukan
am 20 Aug. 2018
If I understood what you are looking for then I would recommend trying 'fit' function. I think it would work
https://www.mathworks.com/help/curvefit/fit.html
8 Kommentare
Sanoop Siby
am 5 Mär. 2020
Lars Gode, Did you happen to find a solution to your question. Please post it if so. Thanks in advance.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!