# Interpolazione lineare

Salve a tutti. Ho due vettori, X e Y, che contengono rispettivamente delle misure. Io vorrei creare un interpolazione lineare tra gli elementi di X e Y in modo tale da stimare i valori intermedi.Il tutto deve servire per costruire una rampa di tensione ,per far questo avevo pensato di usare la funzione anolgwrite ed un circuito rc. Tuttavia il mio problema consiste nella stesura del codice dell interpolazione lineare degli elementi dei due vettori e che questa avvenga in 255 passi. Aspettano vostri suggerimenti nel codice da usare si porgono distinti saluti. Giuseppe

Hi everybody. I have two vectors, X and Y, which contain, respectively, of the measures. I would like to create a linear interpolation between the elements of X and Y in order to estimate the values intermedi.Il must all serve to build a voltage ramp, to do this, I thought about using the function anolgwrite and a circuit rc. However my problem is in the drafting of the code of linear interpolation of the elements of the two vectors, and that this is done in 255 steps. Await your suggestions in the code to use Best regards. Giuseppe

Can you give an explicit example how it looks like? What dimensions do the vectors have?

Sorry for my italian questione. I have 2 pattern of 51 elements. X=[33800 278000 17800 ...615] Y=[0 5 10 15 ... 250]. I have to do the interpolation , for example between the ponint 33800, 0) and (27800,5) . I must do the linear interpolation with all elements of the X and Y pattern. Best regards GIUSEPPE

Please check multimap() - http://playground.arduino.cc/Main/MultiMap - it is written to do just that,

Thanks for all :)

My problem is that to create a linear interpolation ,having two carriers X AND Y, but I donâ€™t have a signal how input. Infact I have to make this linear interpolation because I must send the output of the linear interpolation to anologwrite function, in such a way that I have a voltage ramp that simulates the response of a NTC sensor.

y=mx+q // y have to be a number 0<y<255

anlogwrite(Pin,y) //
Can you help me to write the code that it does this?