MATLAB Answers


Interpolate a set of points

Asked by Q
on 11 Nov 2019 at 3:55
Latest activity Edited by Star Strider
on 12 Nov 2019 at 6:58
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.


Sign in to comment.


1 Answer

Star Strider 님의 답변 11 Nov 2019 4:26
Star Strider 님이 편집함. 약 23시간 전
 채택된 답변

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');
mesh(X, Y, Z)
grid on
axis equal
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.


Q 11 Nov 2019 11:26
Thank you so much for your answer, it really helps alot!
As always, my pleasure!

Sign in to comment.