Interpolation of 3d data to find the value in another point

8 vues (au cours des 30 derniers jours)
Jacopo Rossi
Jacopo Rossi le 16 Fév 2022
I have a 3d data set that represent the derivative of a velocity field in every point of the domain, it's a 3d matrix, where for every set of coordinates I have the value of the derivative. I have a point out of the domain but very close to it, and I want to find the value of the derivative in that point. I was thinking to interpolate the values of the derivative of the domain using cubic splines and then sample the spline in the point of interest to get the value of the derivative. The command interp3 gives me error because it doesn't accept as input the point where I want to evalute the spline, it requires vectors as input. Any advice on which command to use?

Réponses (1)

Ayush
Ayush le 3 Nov 2023
Hi Jacopo,
I understand that you want to a method to interpolate the 3D data to find the value of another point which is velocity in your case.
To do this, you can use the “scatteredInterpolant” function, this will return the interpolant function say “F” for the given data set, using which you can evaluate “F” at a set of query points, such as “(xq,yq,zq)” in 3D, to produce interpolated values “vq = F(xq,yq,zq)”.
You can refer an example below for better understanding:
% Generate some sample data
x = rand(100,1)*10;
y = rand(100,1)*10;
z = rand(100,1)*10;
v = rand(100,1);
% disp(x)
% Define the point of interest
xq = 5;
yq = 5;
zq = 5;
% Interpolate the data using scatteredInterpolant
F = scatteredInterpolant(x,y,z,v);
% Evaluate the interpolated function at the point of interest
vq = F(xq,yq,zq);
disp(vq)
0.4769
For more information on the “scatteredInterpolant” you can refer the below link:
I hope this helps!
Regards,
Ayush

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by