# How do I get the amplitude of a variable sine function?

Let's assume that we have a dynamical system

$$G(s) = \frac{Y(s)}{U(s)}$$

And we have measure the input $u(t)$

And we have measure the output $y(t)$.

Here we can see that if we increase the frequency at the input of the system, the output is going to decrease.

The question is simple: How can I find the amplitudes over time of by just knowing $y(t)$ and $u(t)$. Nothing more.

My goal is to estimate a transfer function from arbitrary frequency input and output and I going to use least square to curve fit on a transfer function.

Can I just drag a line of all peaks/tops of the sine waves?

• Maybe it is just me but: can you please clarify what you are working with? The notation makes me think that it is $Y(s)=\mathcal L\{y(t)\}$ and $U(s)=\mathcal L\{u(t)\}$ but you have fft in the tags – Holo Jan 3 '18 at 4:37
• I did a simple System ID in Python suggestions-for-fitting-noisy-exponentials-with-scipy-curve-fit which massages the data to be smoothly periodic, and takes ratio of ffts of U and Y - for your frequency sweep I would time reverse, invert and concatenate the time series before the fft, and fit the ratio to a Laplace domain transfer function for a shelving low pass filter – f5r5e5d Jan 3 '18 at 5:25
• @Holo I doing system identification of a transfer function into frequency plane. – Daniel Mårtensson Jan 3 '18 at 6:58
• @f5r5e5d Did it work well ? – Daniel Mårtensson Jan 3 '18 at 6:58
• @DanielMårtensson both transform are doing this... – Holo Jan 3 '18 at 7:07

Since you have $u(t)$ and $y(t)$, you can compute the Laplace transform of each and get, by your first equation,
$$G(s) = \frac{L(y(t))}{L(u(t))}.$$