I'm trying to understand the following code, specifically how to use the results of scipy.signal.freqz where w in w, h = freqz(b, a, worN=8000) is in radians/samples.

I need to convert this to the range of $[0.0, 1.0]$ where $0.5$ corresponds to Nyquist frequency and $1.0$ to sample rate. And I'm trying to figure out the smartest way of doing this and whether I can use a general "any number range to any number range" algorithm or whether the radians/samples unit poses some problems regarding this?

NOTE: I know how to convert frequency from $\textrm{Hz}$ to radians-per-sample.

  • 1
    $\begingroup$ Also is the [0.0, 1.0] range possibly called cycles/samples? $\endgroup$ – mavavilj Aug 30 '16 at 16:19

As you noted in your comment, the normalized frequency range [0, 1) cycles/sample corresponds to the range [0, 2*pi) radians/sample. Therefore, given a frequency in the [0, 1) range, simply multiply by 2*pi to convert to radians/sample.

  • $\begingroup$ So do I get from rads/samples to cycles/samples by dividing by 2*pi the rads/samples? $\endgroup$ – mavavilj Aug 30 '16 at 16:44
  • $\begingroup$ Yes, that's right. $\endgroup$ – Jason R Aug 30 '16 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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