Last active
April 12, 2020 04:39
-
-
Save nihalpasham/f471ab92c620c7ad1671f21f8be1c460 to your computer and use it in GitHub Desktop.
DSSS Code Sequence vs Sinc interpolated Code Signal
This file contains hidden or 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
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from matplotlib.pyplot import step, xlim, ylim, show | |
| k = 16 | |
| 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]) | |
| # code-sequence | |
| b = np.tile(a, 1) | |
| x = np.arange(0, 127) | |
| # code-signal | |
| upsampled_signal = upsample(b, k) # upsample is a function in the sinc interpolation module. | |
| fig, (ax1, ax2) = plt.subplots(2, figsize=(17,13)) | |
| ax1.step(x, b) | |
| ax1.set(xlabel='Sample Number', ylabel='Amplitude') | |
| ax1.set_title('127-bit DSSS Binary Code Sequence', fontsize=12, fontweight="bold") | |
| ax2.plot(us1, 'tab:green') | |
| ax2.set(xlabel='Sample Number', ylabel='Amplitude') | |
| ax2.set_title('Sinc Interpolated DSSS Code Signal', fontsize=12, fontweight="bold") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment