1

I have a signal which like this: I want to calculate this signal's instantaneous frequency.I have tried hht and so on which method I can find but can not get the result. So does somebody can give me some advice? If can proveide some python program which will be must useful for me.Thanks!

UPDATED: Thanks @OverLordGoldDragon I use this code in this answer:

import numpy as np
from ssqueezepy import ssq_cwt, extract_ridges
from ssqueezepy.visuals import plot, imshow

z = see OP's code; used np.random.seed(1000)

beta = 24 Tx, Wx, ssq_freqs, scales, *_ = ssq_cwt(z, ('gmw', {'beta': beta}), padtype='zero', fs=6) ridge_idxs = extract_ridges(Tx, scales, penalty=20)

plot(ridge_idxs, color='k', linestyle='--', xlims=(0, len(z) - 1)) imshow(Tx, abs=1, yticks=ssq_freqs[::-1], ylabel="Frequencies [Hz]", title="abs(SSQ_CWT), wavelet=('gmw', {'beta': %s})" % beta) amplitude = np.abs(Tx[ridge_idxs[:, 0], np.arange(len(z))]) frequencies = ssq_freqs[::-1][ridge_idxs[:, 0]]

plot(amplitude, ylims=(0, None), title="Amplitude vs time, SSQ ridge", show=1) plot(frequencies, ylims=(0, None), ylabel="Frequencies [Hz]", title="Frequency vs time, SSQ ridge", show=1)

But my result like this: enter image description here Which seems disorder.

user57947
  • 13
  • 3

1 Answers1

0

Synchrosqueezing with ssqueezepy.

enter image description here

from ssqueezepy import TestSignals, ssq_cwt
from ssqueezepy.visuals import plot, imshow

x = TestSignals(N=2048).lchirp()[0] Tx, , ssq_freqs, * = ssq_cwt(x) plot(x, title="linear chirp", show=1) imshow(Tx, abs=1, title="abs(SSQ_CWT)", xlabel="time", ylabel="frequency", yticks=ssq_freqs[::-1])

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74