# How to make a 3D interpolation function?

I have a following data,

 x , y , z, f(x,y,z)
0.0,0.0,0.0,1.532704
0.04,0.0,0.0,1.520342
0.08,0.0,0.0,1.484285
0.12,0.0,0.0,1.426193
0.16,0.0,0.0,1.353395
0.2,0.0,0.0,1.269138
0.24,0.0,0.0,1.17861
0.28,0.0,0.0,1.090471
0.32,0.0,0.0,1.005581
0.36,0.0,0.0,0.933414
0.4,0.0,0.0,0.877248
0.44,0.0,0.0,0.836819
0.48,0.0,0.0,0.816123
0.04,0.04,0.0,1.504544
0.08,0.04,0.0,1.478109
0.12,0.04,0.0,1.43574
0.16,0.04,0.0,1.373018
0.2,0.04,0.0,1.294042
0.24,0.04,0.0,1.204979
0.28,0.04,0.0,1.108072
0.32,0.04,0.0,1.016175
0.4,0.04,0.0,0.857493
0.44,0.04,0.0,0.820139
0.48,0.04,0.0,0.802623


I want to make a 3D interpolating function using this data. If I use the simple Interpolation,

Interpolation[Transpose[{Transpose[{x, y, z}], f}]];


Then the following error occurs,

Does anyone have a solution?

• Some of the data rows have four elements and some have five elements. Fix the data. Oct 20, 2023 at 2:46
• @BobHanlon Fixed it Oct 20, 2023 at 3:13
• How are you importing the data? Are they in a csv file? Oct 20, 2023 at 3:29
• @MelaGo Yes. Then assigning x = First Column, y = Second Column, and so on. Oct 20, 2023 at 3:51

data = Import["data.csv"]

ListPlot3D[data[[All, {1, 2, 4}]]]

f = Interpolation[data[[All, {1, 2, 4}]]]