Quote Originally Posted by DizzyMoods View Post
This type of resampling works well if I am operating with linearly sampled data (XData and YData are equidistant.
One comment on your code: Spectrogram::value is called very often ( for each pixel ! ) and you should try to implement it as fast as possible. Better calculate dx and dy once instead of recalculating it again and again.

Quote Originally Posted by DizzyMoods View Post
How can I improve this algorithm for a series of non-linearly scaled data (i.e. XData = [1 10 20 50 70 100 1000])?
Your code implements a nearest neighbor resampling. You can do the same for XData - beside the algorithm how to identify the next neighbor is different.

Again you should be aware of the fact, that Spectrogram::value is called very often and heavy calculations shouldn't be avoided if possible. F.e. you could overload QwtRasterData::initRaster() and QwtRasterData::discardRaster() to initialize some values, that are constant for the situation - or build a temporary linear value matrix.

Uwe