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

6 ビュー (過去 30 日間)
Jacopo Rossi
Jacopo Rossi 2022 年 2 月 16 日
回答済み: Ayush 2023 年 11 月 3 日
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?

回答 (1 件)

Ayush
Ayush 2023 年 11 月 3 日
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

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by