I have used the code from: https://github.com/quantumlib/OpenFermion/blob/v1.5.1/src/openfermion/linalg/wave_fitting.py#L41-L76

try using with my signal:

def ns_s(t):
    if t >= 0 and t < 0.1:
      return 10*np.cos(20*np.pi*t)

    if t >= 0.1 and t <= 0.4:
      return 10*np.cos(20*np.pi*t)+3*np.sin(40*np.pi*t)
    if t > 0.4:
      return 0.0

def s_s(t):
  return 10*np.cos(20*np.pi*t)+3*np.sin(40*np.pi*t)+.01j

def s_old(x):
  return 3*np.sin(20.0*2.0*np.pi*x)+np.cos(50.0*2.0*np.pi*x)

FFT mag:

enter image description here

STFT mag:

enter image description here

Prony amplitudes:

enter image description here

What should I do to make it work? I tried complex signal but it doesn't work with it either (and fft, stft looks like random).

With stationary signal it's doesn't work also:


enter image description here


enter image description here

  • 1
    $\begingroup$ Welcome to our forum. Your code just defines 3 signals but doesn't show what you are specifically doing with them, what your expected result is, and why you think what you have is wrong. Please add more detail and background. $\endgroup$
    – Hilmar
    Jan 10, 2023 at 12:34
  • $\begingroup$ I expected Prony results is close to FFT $\endgroup$ Jan 10, 2023 at 12:36
  • $\begingroup$ What parameters you gave to the function you used. $\endgroup$
    – learner
    Jan 10, 2023 at 12:47
  • $\begingroup$ @learner x = np.arange(0, np.pi/6, T) y = np.array(list(map(ns_s, x))) $\endgroup$ Jan 10, 2023 at 17:26
  • $\begingroup$ Your code doesn't show you calling a Prony solver. $\endgroup$
    – TimWescott
    Jan 10, 2023 at 19:27


Your Answer

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