Interpolate a set of points

4 vues (au cours des 30 derniers jours)
Q
Q le 11 Nov 2019
Modifié(e) : Star Strider le 12 Nov 2019
Hi,the goal is to use these points to recreate the curved surface via spline interpolation in Matlab and compare with the CAD model.
I have tried using griddata and of course the figure wasnt even close to the original model. I tried using scatteredinterpolant function following matlab guide but I am confused at some time as I have no idea how to get a 3d curve as a result instead of slices. For the 'v', I am not sure but I assume that 'v' decides the type of interpolation.
My question is, how to create this surface using scatterdinterpolant function? or is there any other better ways to achieve this?
Thank you in advance.

Réponse acceptée

Star Strider
Star Strider le 11 Nov 2019
Modifié(e) : Star Strider le 12 Nov 2019
I am not certain what you want.
The figure produced by this code appears quite similar to your original plot image:
D = readmatrix('data.xlsx');
xv = linspace(min(D(:,2)),max(D(:,2)), 250);
yv = linspace(min(D(:,3)),max(D(:,3)), 250);
[X,Y] = ndgrid(xv, yv);
Z = griddata(D(:,2), D(:,3), D(:,4), X, Y, 'cubic');
figure
mesh(X, Y, Z)
grid on
axis equal
view(125,15)
producing:
The z-scale is different (I use axis equal here, so the x, y, and z units are essentially the same), however they otherwise seem quite similar.
I do not understand the code image you posted, or what you are doing with the ‘v’ and ‘F’ assignments, since they do not appear to be relevant.
  2 commentaires
Q
Q le 11 Nov 2019
Thank you so much for your answer, it really helps alot!
Star Strider
Star Strider le 11 Nov 2019
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by