When I do frequency analysis on my feedback controlled system and the controller is really tightly tuned, I get a frequency response that looks like this:

enter image description here

Blue is excitation signal and green is system output signal. Does this mean that my system has nonlinear behavior? Or this just a condition that would be visible when hitting a zero or a pole?

Smaller frequencies work fine and produce a sine wave output that is easy to interpret. It is higher frequencies that end up looking like this.

Since I intend to use this to derive a bode plot, I'm also curious how do I interpret this data and what is the actual magnitude and phase on this plot for this frequency? It seems to me like it is fairly random. How would I go about sweeping frequencies and making a bode plot when many frequencies in this region look like this? FFT maybe on both signals? But how exactly?

  • $\begingroup$ If this diagram starts at $n=0$ then what you are looking at there is transient response. Can you please post a plot that runs all the way to 50? $\endgroup$
    – A_A
    Jan 10, 2018 at 9:12

2 Answers 2


You are probably still seeing other frequency components from the transient of the system. I assume you that you simulated your system for a fixed number of periods of the excitation signal. If this is the case then it would also explain why you only see the transient at high frequencies. This would be because a fixed number of high frequency periods take less time than the same number of low frequency periods. Therefore there is not enough time for the transient to die out for the high frequency excitation.


Have you tried using synchronous demodulation to extract the phase and amplitude response for the various frequencies? You would reject the transient and other non-linearities this way. Also, you could flush the transient samples (not always possible).

Edit :

say your stimulus is x = A * cos (wt).

Then your output to this stimulus is y = B*cos(wt + phi) (after transient)..

create a signal called x_quad = A*sin(wt)

Now with x, y and x_quad you can find B and phi. The gain at the specific frequency is B/A

now for the math

z = xy = AB*cos(wt)cos(wt + phi) = AB/2* (cos(2*wt) + cos(phi))

z_quad = x_quady = AB*sin(wt) * cos(wt + phi) = A*B/2 * (sin(2*wt) + sin(-phi))

Now, average z over 1 cycle or more for better precision in order to cancel the cos(2*wt) term.

z_mean = A*B/2 * cos(phi)

z_quad_mean = -A*B/2*sin(phi)

then phase = Atan2(-z_quad_mean, z_mean)

B/A = 2/A*sqrt(z_mean^2 + z_quad_mean^2) = gain

Make sure to review the math, might have made a mistake or 2. But you get the main idea

  • $\begingroup$ I found amdemod which I could probably use, but can you elaborate in more detail what your method would be to extract phase and amplitude response? $\endgroup$
    – Martin
    Jan 10, 2018 at 15:52
  • $\begingroup$ say x is your input, x = Acos(wt) now create a signal called x_quad = Asin(wt) now you also have your output signal y = Bcos(wt + phase); z1 = xy = AB/2 (cos(2*wt + phase) + cos(phase)) z2 = x_quady = AB/2 * (sin(2*wt + phase) - sin(phase)) If you average z1 and z2, you will get a DC value corresponding to the cosine of the phase and sine of the phase respectively. Sine divided by cos is the tangent, right? You can use the arc tangent function. You can also extract the amplitude "B" using sqrt(z1^2 + z2^2) $\endgroup$
    – Ben
    Jan 10, 2018 at 16:09
  • $\begingroup$ But I don't know phase. I need a way to identify that as well. $\endgroup$
    – Martin
    Jan 12, 2018 at 1:28
  • $\begingroup$ You created the stimulus right? So you can create a phase-delayed version of the stimulus. $\endgroup$
    – Ben
    Jan 12, 2018 at 13:42
  • $\begingroup$ How would that help, Ben? That's kindout of the whole point. To test it with a range of input frequencies and measure phase delay as well as the attenuation. $\endgroup$
    – Martin
    Jan 13, 2018 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.