Skip to content

Instantly share code, notes, and snippets.

@nihalpasham
Last active April 13, 2020 03:20
Show Gist options
  • Save nihalpasham/bd5503247faeb35bbdd1760b8288d200 to your computer and use it in GitHub Desktop.
Save nihalpasham/bd5503247faeb35bbdd1760b8288d200 to your computer and use it in GitHub Desktop.
Plotting a DSSS binary code sequence
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import step, xlim, ylim, show
a = np.array([-1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1])
b = np.tile(a, 1)
x = np.arange(0, 127)
fig, (ax1) = plt.subplots(1, figsize=(15,4))
ax1.step(x, b)
ax1.set(xlabel='Sample Number', ylabel='Amplitude')
ax1.set_title('127-bit DSSS Binary Code Sequence', fontsize=12, fontweight="bold")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment