Trying to write a signal "unsmoothing" algorithm Up front: I'm just a hobbyist, and I know zero about signal processing; I'm trying to write a simple(?) javascript algorithm and hoping I don't need a PhD in DSP to make progress on it.

I have an input signal that often shows only the tiniest difference between the max value and the min value. I'm trying to figure out a way to convert the values such that the max is proportionally much larger than the min, with a steep curve in between. I've tried everything I can think of with exponents and logarithms, even just subtracting the min from the rest of the curve, but nothing seems to work. Part of the problem, as can be seen in my awesome diagrams below, is that the signal strength varies quite a bit; I don't know how to account for that. Also, sometimes the signal is already pretty spikey, and I don't know how to account for that either.

I've poked around with google, but I don't really know what questions to ask. I'm not sure whether there is a class of algorithms that does this sort of thing. I tried "signal unsmoothing", with no luck, and I don't know what else it could be called.

Some hand-drawn diagrams, placeholders while I try to learn how to draw curves on stackexchange. The two on the left show the kinds of signals I often get: varying strength, but the max is barely bigger than the min. The one on the right is what I'm trying to get: a big spike in the middle with a steep curve down to the min.

Is there a name for a class of algorithms that does this sort of thing? Is there a better way to formulate my questions so I can google more effectively? Is there a ridiculously trivial way to do this?



In case it helps, my ultimate goal: I'm modeling the movement of mosquitos. I'm working on getting them to move toward the smell of their prey while accounting for negative factors such as toxins in the air, or high temperature, as well as their jittery motions to avoid being squashed. It's going pretty well, except I have this chronic problem of the input signals being too flat for meaningful comparisons.
What you are trying to do is Contrast Enhancement. Contrast is the ratio of maximum to the minimum.

Lets consider as example that your signal's intensity is ranging from 30 to 40 but you need a range of 0 to 255 with good contrast.


Lets consider your 1D signal as I(x). First find the minimum of the signal and subtract min from the whole curve. In our example 30 is the minimum.So subtract 30 from the whole curve.The signal will be ranging from 0 to 10 now.



  J(x) = I(x) - Min(I(x))



But we want the intensity of the signal from 0 to 255. So find the ratio between the maximum value allowed(255 in our case) to maximum of your signal(our signal max is 10 now) and multiply the whole curve with that factor. Now our signal's intensity will be ranging from 0 to 255.



  K(x) = J(x)*(Max_value_allowed/Max(J(x))



At this point you should have got the spikey curve you need. But if you feel the curve is not spikey enough, contrast can be increased by applying negative slope to intensities in first half of histogram(In our case 0 to 127) and positive slope to intensities in second half  of histogram(128 to 255 in our case) which will make lower intensities much lower and the high intensities much higher.Good luck.Hope this helps you.


Added:Instead of above step3 you could also do,


  L(x) = power(K(x),n)/power(Max(K(x)),n-1)


n should be greater than 1.As n increases the spikiness also increases. In your case choosing around 2 or 3 should be enough I guess.