Interpolation

Dear Experts,
I was looking for the way to make 2D interpolation based on two input values (Qb/Qc, Ab/Ac):

I.e.:
Qb/Qc = 0.285
Ab/Ac = 0.303
Result: 0.88

@kvusal ,

i found just python stuff
https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html
KR
Andreas

2 Likes

I think its possible with just Dynamo too. Something like that:

Lets say this is the list with the positions, by the given example all the Q and A values:

The matrix is a list of lists so it’s easy to represent in a simple way in Dynamo. You round the numbers and get the closest value for both positions, while you also define a multiplier like that:

In the end, you get the two indexes, you can use them to get the value from a second matrix and apply the multiplier.

I haven’t had time to validate the logic, but I think it should work at least as a general concept :slight_smile:

EDIT: I actually think the logic is ok, but the multiplier formula should be a bit different:

Home.dyn (26.6 KB)

2 Likes

Hello, here is a possibility
(Data must exist in csv format)


edit: I substituted the hastily written code block with a python script, in case you go that route.
Python Script:

List_Polycurve=IN[0]

OUT = [[List_Polycurve[i],List_Polycurve[i+1]] for i in range(0,len(List_Polycurve)-1)]

Cordially
christian.stan

2 Likes

wow, turning the matrix into a surface and simply getting a point’s Z value, brilliant ! :slight_smile:

2 Likes

Thanks,here’s the dot matrix (now my eyes hurt with this data, time to bask :wink:)
and the complete script.

here
a=1..9;
[a,a,a,a,a,a,a,a,a];
[[0.73,0.34,0.32,0.34,0.35,0.37,0.38,0.39,0.40],
[3.10,0.73,0.41,0.34,0.34,0.32,0.32,0.33,0.34,0.35],
[7.59,1.65,0.73,0.47,0.37,0.34,0.32,0.32,0.32],
[14.2,3.1,1.28,0.73,0.51,0.41,0.36,0.34,0.32],
[22.92,5.08,2.07,1.12,0.73,0.54,0.44,0.38,0.35],
[33.76,7.59,3.1,1.65,1.03,0.73,0.56,0.47,0.41],
[46.71,10.63,4.36,2.31,1.42,0.98,0.73,0.58,0.49],
[61.79,14.2,5.86,3.1,1.9,1.28,0.94,0.73,0.6],
[78.98,18.29,7.59,4.02,2.46,1.65,1.19,0.91,0.73]];

24 Mai Forum anglais.dyn (23.9 KB)

Good evening
edit: She has a funny look this surface :grinning:

Cordially
christian.stan

4 Likes