-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added frequency sweep, gaussian pulse and pwm modulation arbitrary wa…
…veform genearion python scripts.
- Loading branch information
Showing
6 changed files
with
6,208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/env python | ||
|
||
# generata a frequency sweep | ||
|
||
import numpy as np | ||
from scipy.signal import chirp | ||
import matplotlib.pyplot as plt | ||
|
||
showplot = False | ||
t = np.linspace(0, 1, 2048) | ||
waveform = chirp(t, f0=1, f1=50, t1=1, method='linear') | ||
|
||
print("# frequency sweep using scipy.signal.chirp") | ||
for y in waveform: | ||
print(y) | ||
|
||
if showplot: | ||
plt.plot(t, waveform, '--') | ||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/env python | ||
|
||
# generata a gaussian pulse | ||
|
||
import numpy as np | ||
from scipy.signal import gausspulse | ||
import matplotlib.pyplot as plt | ||
|
||
showplot = False | ||
t = np.linspace(-1, 1, 2048) | ||
waveform = gausspulse(t, fc=5) | ||
|
||
print("# gaussian pulse using scipy.signal.gausspulse") | ||
for y in waveform: | ||
print(y) | ||
|
||
if showplot: | ||
plt.plot(t, waveform, '--') | ||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/env python | ||
|
||
# generata pwm modulated signal | ||
|
||
import numpy as np | ||
from scipy.signal import square | ||
import matplotlib.pyplot as plt | ||
|
||
showplot = False | ||
t = np.linspace(0, 1, 2048) | ||
sig = np.sin(2 * np.pi * t) | ||
waveform = square(2 * np.pi * 25 * t, duty=(sig + 1)/2) | ||
|
||
print("# pwm modulation using scipy.signal.square") | ||
for y in waveform: | ||
print(y) | ||
|
||
if showplot: | ||
plt.plot(t, waveform, '--') | ||
plt.show() | ||
|
Oops, something went wrong.