I have a AS7265x triad spectroscopy sensor from SparkFun (link) which gives me measurements at 18 individual light wavelengths between 410nm and 940nm. The datasheet says that the FWHM of each sensor is 20nm.
How can I draw a smooth spectrum given these 18 numbers?
My approach so far is to use interpolation by radial basis functions. I tried gaussian functions with FWHM=20nm but this is what I get for an artificial signal with a constant spectrum of all ones:
I experimented with other radial basis functions and found that a multiquadric function gives me the best result. It produces a flat interpolation when each measurement is equal to one. However, it looks strange at frequencies below the lowest measured frequency and above the highest one:
I fix this by requiring the lines at both ends to decrease to zero as gaussians with FWHM=20nm and amplitudes equal to the values measured at 410nm and 940nm.
Also, sometimes this interpolation shows negative values, for example, when only a single measurement is one, and all other are zeros:
I fix it by simply putting the values of the spectrum to zero where it is negative.
I tested it with a few LEDs, and I am getting spectra from them that look realistic. However, I have a feeling that my approach has too many quick fixes. My code and LED spectra are here.
Is what I am doing an acceptable way to draw a spectrum from a limited number of sensors that don't densely cover the whole range of frequencies? If not, how to do it correctly?