필터 지우기
필터 지우기

Interpolation of function of 3 variables

조회 수: 4 (최근 30일)
PASUNURU SAI VINEETH
PASUNURU SAI VINEETH 2022년 1월 29일
댓글: Voss 2022년 1월 29일
I have 4 variables in the problem where the last variable is the function of first three. The attached excel sheet contains the sample data. The following code throws an error when I try to interpolate. Please help me figure out the issue.
SideForceData = readmatrix("Swing_Digitization.xlsx");
SeamAngle_data=SideForceData(:,1);
spin_data=SideForceData(:,2);
vel_data=SideForceData(:,3);
Fswing_data=SideForceData(:,4);
spin=10;
vel=40;
SeamAngle=25;
Fswing = interp3(SeamAngle_data, spin_data, vel_data, Fswing_data, SeamAngle, spin, vel);
Error using griddedInterpolant
Interpolation requires at least two sample points for each grid dimension.

Error in interp3 (line 132)
F = griddedInterpolant({X, Y, Z}, V, method,extrap);

채택된 답변

Voss
Voss 2022년 1월 29일
It looks like the data in that file is insufficient for making a gridded interpolant (because there is no information about Seam Angle = 30, Spin Rate = 11.4, 14.2), so you have to use a scattered interpolant instead:
SideForceData = readmatrix("Swing_Digitization.xlsx");
SeamAngle_data=SideForceData(:,1);
spin_data=SideForceData(:,2);
vel_data=SideForceData(:,3);
Fswing_data=SideForceData(:,4);
spin=10;
vel=40;
SeamAngle=25;
% Fswing = interp3(SeamAngle_data, spin_data, vel_data, Fswing_data, SeamAngle, spin, vel);
I = scatteredInterpolant(SeamAngle_data, spin_data, vel_data, Fswing_data);
Fswing = I(SeamAngle,spin,vel);
disp(Fswing);
0.2410
  댓글 수: 2
PASUNURU SAI VINEETH
PASUNURU SAI VINEETH 2022년 1월 29일
Thanks a ton! If I have sufficient data (data value for every node), will the scattered interpolant be the same as gridded interpolant?
Also, is there an inbuilt interpolation (gridded or scattered) command for more than 3 variables?
Voss
Voss 2022년 1월 29일
Yes, I believe they should be the same in that case. For more than three variables, look into griddatan().

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by