# Approximating a function with a sine function: transform into constant amplitude?

I have a smooth function, it is stationary. So I tried approximating my function with regression by fitting a sine function that changes period, phase & frequency every observation to get the exact shape, which worked ok. Now, my question is: is there a way to transform that function so the amplitude would be constant (=1) without causing any change in the period, in real time (causal)?

-
I'm somewhat confused by your question: What exactly is it you want to do? Which function do you wish to transform? –  Johannes Kloos Mar 12 '12 at 19:16
A function with variable periodicity and amplitude which kind of resembles a sine wave: I want to transform it so it has a constant amplitude, and this transformation should work in real time (only use data from the past if you have a window sliding over the time series) –  MisterH Mar 12 '12 at 19:37
Do you have an estimate of the frequency? In that case, measure amplitude over one period, and use it to scale the function linearly. If not, you may be able to work out something by approximating the derivative as well (say, via pairwise differences of values), but I don't know how well that works. –  Johannes Kloos Mar 12 '12 at 20:49
Actually no I don't have an estimate of frequency: I am confused because I got a good fit, but I somehow screwed up my frequency in my code.. I will rephrase my question. Sorry for this. –  MisterH Mar 14 '12 at 13:44