Algorithmically obtain the amplitude and phase of a sine wave?

I am trying to find a way to algorithmically obtain the amplitude and phase of a function that has sinusoidal terms in the Maxima computer algebra system. This applies only to the steady state (at t β†’ infinity and decay of transients). For example, a trivial case:

f(t) = 1 / w * sin(w * t + theta) + exp(-a * t) + 8 

In this case, the gain will be 1 / w, the phase shift will be theta, and we will ignore the transition term exp (-a * t), because we only care about stable gain and phase delay and exp (-a * t) β†’ 0 as t β†’ infinity. We will also ignore the term "+ 8" because it is simply a DC bias. The way I was taught to do this in my engineering classes requires a lot of heuristics and tedious rearrangement of equations to get them in a form similar to the one above, where the answer is obvious just by looking at it.

Does anyone know of a general algorithmic method for finding gain and phase delay, assuming they exist, given that I have a complete computer algebra system (and the standard functions that you would expect from CAS) to throw at that? Although I will most likely implement it in Maxima, I would certainly appreciate the general answers, explained only from the point of view of mathematics.

Edit: I thought it was perfectly clear from my example that I want the answer symbolically, from the point of view of w. w really needs to be omega and represents the input frequency. I really ask if there are any standard mathematical operations that will generate gain and phase without a heap of heuristic manual equation conversion.

+4
source share
4 answers

Do you mean symbolically or numerically?

In numerical form, you want to perform the Fourier Transform :

  • try on a function at least twice the expected maximum frequency (even higher if you want a more accurate phase measurement) and until at least your maximum expected wavelength

  • perform a Fourier transform (the FFT search should include many examples - my search queries suggest that maxims may even have a built-in fft function)

  • this will give you a version of your frequency domain. You will have a number of complex values, where the magnitude is the amplitude of this frequency, and the angle is the phase of this frequency component. In your case, it sounds like you want to find a frequency with peak amplitude

+7
source

It may or may not be ideal, but I assume that you cannot do the math on a function generating a waveform (or the function is not available) -

I would try the wave at intervals much shorter than the period. This is probably difficult - you probably need to know for sure that the peirod wave is larger than the sampling interval, but you do not want it to be too small, or you will need to finish several wave cycles forever. Perhaps you can start sampling with a minimum value and expand it until the value changes at some reasonable speed.

If you do this, you can center the wave along the X axis (by subtracting or adding an average value) and determine 1) The minimum / maximum values ​​that provide the amplitude and 2) the X-intercepts that the period provides.

+1
source

Either the Laplace transform or the Fourier transform may help; you can apply both symbolically and numerically. But I'm not sure that you can create a general algorithmic method - usually there are different cases in which the poles are located.

+1
source

After thinking about this for a while, I realized this myself. I will post it here because it is quite interesting. Assumptions:

  • The signal exists for infinite time, so everything is in a stable state.
  • Your expression has only one frequency. It is easy to check only by inspection, even if it is in some terribly complex form. For example, you cannot have sin (w1 * t) + sin (w2 * t), otherwise it will not work.
  • You know what the variables of frequency and time are called.
  • You have a decent computer algebra system and all the standard functions that come with it.

The algorithm in these assumptions:

  • Take the Laplace transform. In practice, this is trivial, since most of the time when you encounter such problems, your answer is initially in the Laplace domain, and you end up moving back to the time domain to get a sine wave expression. Even if not, a decent CAS will already have a mature Laplace transform function.
  • Separate the Laplace transform sin (w * t). (Assuming you use w for frequency and t for time). This gives you the transfer function, that is, the constant of the Laplace domain that the sine wave introduces.
  • As t β†’ infinity, i.e. for signals that existed indefinitely, the Laplace variable s is equivalent to iw, therefore, simply substituting iw for s, you get the transfer function in the frequency domain, in fact, the Fourier transform of the transfer function.
  • For a sine wave w, the gain is the complex absolute value of the transfer function. (The complex absolute value is the distance of some complex number from the origin in the complex plane, sqrt (realpart (my_number) ^ 2 + imagpart (my_number) ^ 2).
  • The phase shift is simply arctan (imaginarypart (transferFunction) / realpart (transferFunction)).
0
source

All Articles