Interpolation of 3D point data
70 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
shellmcg
el 19 de Abr. de 2016
Comentada: Adam Danz
el 19 de Dic. de 2019
Hello, I have a nx5 matrix where column 3, 4 and 5 are x,y,z 3D points respectively. I was wondering how I would interpolate (smooth) this 3D data. Many thanks
4 comentarios
Walter Roberson
el 20 de Abr. de 2016
What properties does the curve need to have? Are you looking for a spline fit? A pchip fit?
Respuesta aceptada
John D'Errico
el 29 de Abr. de 2016
Editada: John D'Errico
el 29 de Abr. de 2016
You can use my interparc tool, as found on the file exchange. It is designed to solve exactly this problem, in 2 or more dimensions.
xyz = interparc(1000,x,y,z,'spline');
xyz will be a 1000x3 array, where each row is an interpolated point on the curve.
Of course, you can do the interpolation in other ways. If you want to do the work in MATLAB yourself in much the same way as you tried to do it:
t = [0;cumsum(sqrt(diff(x).^2+diff(y).^2+diff(z).^2))];
t = t/t(end);
ti = linspace(0,1,1000);
xx = spline(t,x,ti);
yy = spline(t,y,ti);
zz = spline(t,z,ti);
The above solution, which uses a cumulative piecewise linear arclength as the parameter for interpolation, deals more properly with points that are not uniformly spaced.
0 comentarios
Más respuestas (2)
Walter Roberson
el 20 de Abr. de 2016
It looks to me as if you likely want a scattered interpolant.
2 comentarios
shellmcg
el 22 de Abr. de 2016
Editada: Walter Roberson
el 22 de Abr. de 2016
Adam Danz
el 19 de Dic. de 2019
shellmcg
el 28 de Abr. de 2016
1 comentario
John D'Errico
el 28 de Abr. de 2016
Editada: John D'Errico
el 29 de Abr. de 2016
I'm sorry, but this answer is just a poor way of solving the problem, presuming the points are somehow equally spaced. Use of a spline as was done here can cause some strange artifacts.
Ver también
Categorías
Más información sobre Smoothing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!