Hello guys, I'm new to Arduino and if I apologize if I'm posting this under the wrong section.
Currently, I'm trying to convert my MATLAB written script to Arduino codes manually and in the script, I am using an in-built command called "interp1" to perform interpolation so that I get a fixed number of samples as my output everytime I call this command. However, Arduino doesn't have this in-built command and thus, I have to write the codes (Calculations) manually in terms of C/C++.
I tried to search online but could not find relevant formula/methods used to calculate non-linear interpolation and therefore, I'm posting this now to see if anyone implemented non-linear interpolation using Arduino before and could help me.
Basically in MATLAB, I have this SignalX which consist of some random number of elements (not fixed) and when I use this command to perform interpolation, my SignalX will now consist of 40 elements,
y = interp1(originalxaxis,SignalX,newxaxis);
where
originalxaxis is the number of samples that plots signalX
(The number of samples in signalX is different everytime) INPUT
newaxis is the new number of samples I want to get
(for my case, I want signalX to be plot using 40 samples) OUTPUT
So for example,
SignalX = [6 7 14 30 80 147 155 170 150 11 24 112 81 91 92]; 13 samples
and after interpolation,
SignalX = [6.5493 6.0820 6.0190 6.2813 6.7896 7.8833 10.5123 14.0000 18.3584 24.5474 33.6856 50.8722 72.7026 97.8516 128.7401 147.0000 150.7079 152.9526 156.6432 163.8043 169.4981 168.5142 161.4505 150.0000 100.8972 31.0796 11.2489 14.6683 21.2734 40.9356 86.1473 112.0000 102.1914 85.8438 81.4048 85.7727 90.3963 91.4119 91.8434 92.000] 40 samples
Regardless of how many samples as my input, what I want to achieve is to get 40 samples after performing interpolation (non-linear)
Sorry if my explanation above is poor,
Thank you