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 CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by