0

If I have a function like below:

G(s)= C/(s-p) where s=jw, c and p are constant number.

Also, the available frequency is wa= 100000 rad/s. How can I discretize the signal at ∆w = 0.0001wa in Python?

martineau
  • 119,623
  • 25
  • 170
  • 301
Hey There
  • 275
  • 3
  • 14

1 Answers1

1

Use numpy.arange to accomplish this:

import numpy as np

wa = 100000
# np.arange will generate every discrete value given the start, end and the step value
discrete_wa = np.arange(0, wa, 0.0001*wa)

# lets say you have previously defined your function 
g_s = [your_function(value) for value in discrete_wa]
Hemerson Tacon
  • 2,419
  • 1
  • 16
  • 28
  • 1
    Note that you'd probably use a vectorized function instead of looping over the numpy array in most circumstances, otherwise you'll be slowing down your code a lot. – alkasm Nov 20 '18 at 23:37