Hi Poley,

XC16 installation page:

https://microchipdeveloper.com/xc16:installation

I think you install the free version, then you are prompted if you want to set a license key...

Within your LookUp Table, ensure datatype is set appropriately (16 bit fixed point whenever possible for best efficiency on dsPIC)

Regarding function approximation, there is a "

Curve fitting toolbox" within matlab.

If you already know the type of function that would fit your curve, there might also be a possibility to get results through linear algebra resolution problem resolution thus using only matlab base functions on matrix.

I do not know if you have constraints in terms of execution speed in your application.

Regarding math function execution time, few ones could be accelerated using the "Code Replacement" option for the dsPIC where generated code for a short list of operation are replaced by Microchip optimized code for dsPIC.

However if such function require math which would be too slow to compute on the dsPIC, you might generate an optimized lookup table: Interpolated one, where a limited number of (x,y) points are placed so as to minimize the worst case interpollation error. The Matlab function

fixpt_look1_func_approx is in the base matlab package and works great. It can compute the minimum numer of point required for a given error threshold.