Generation of elementary signal in python

from matplotlib import pyplot as pltplt.style.use('ggplot')xval = [x for x in range(-100,100)]yval=[]for t in range(-100,100):
if t==0:
yval.append(1) else: yval.append(0)plt.plot(xval,yval,label="delta function")plt.xlabel("time")plt.ylabel("Amplitude")plt.grid(True)plt.legend()plt.show()
Delta function
from matplotlib import pyplot as pltplt.style.use('ggplot')x_val = [x for x in range(-100,100)]y_val =[]for x in x_val:      if x>=0:         y_val.append(1)      else:         y_val.append(0)plt.plot(x_val,y_val,color='g',label="Step signal")plt.legend()plt.title("step signal")plt.xlabel('time')plt.ylabel('amp')plt.show()
Step Function
from matplotlib import pyplot as pltplt.style.use('ggplot')x_val = [x for x in range(-50,50)]y_val=[]for x in x_val:      if x>=0:         y_val.append(1)      else:         y_val.append(-1)plt.stem(x_val,y_val,label="signum function")plt.legend()plt.title("Signum Function")plt.xlabel("Time")plt.ylabel("Amplitude")plt.show()
Signum Function
from matplotlib import pyplot as pltimport numpy as npplt.style.use('ggplot')x_val = np.arange(-np.pi,np.pi,0.5)y_val = [np.sin(x) for x in x_val]plt.plot(x_val,y_val,color='g',label="sine wave")plt.legend()plt.title("Sine wave")plt.xlabel("Time")plt.ylabel("Amplitude")plt.show()
Sine wave
from matplotlib import pyplot as pltimport numpy as npplt.style.use('ggplot')x_val = np.arange(0,4*np.pi,0.5)y_val = [np.cos(i) for i in x_val]plt.plot(x_val,y_val,label="cos wave")plt.legend()plt.title("Cos wave")plt.xlabel("Time")plt.ylabel("Amplitude")plt.grid(True)plt.tight_layout()plt.show()
cosine
from matplotlib import pyplot as pltplt.style.use('ggplot')x_val = [x for x in range(-10,100)]y_val=[]t=0for x in x_val:      if x>=0:         y_val.append(t*1)         t+=1     else:         y_val.append(0)plt.plot(x_val,y_val,label="Ramp signal")plt.legend()plt.xlabel("Amplitude")plt.ylabel("Time")plt.title("Ramp signal")plt.show()

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

BI Tools for Startups

Recommendations on Buying Used Vehicle Based on Regression Analysis

Machine Learning Model — Gold Price Prediction

Excel Users, Here’s How to Take Your Data Analysis and Reports to The Next Level

Outsourcing for Cost Efficiency, Technological Advantages, and Productivity

The #1 Question People Ask About OCR

Binary trees, what are they?

My Journey as a Data Scientist

Me and my team at CovenLab

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nilay Paul

Nilay Paul

More from Medium

Python Plots--Seaborn Plots

Introduction Python Machine Learning

Adaptive metropolis algorithm Python code

2nd Edition of My Book Now Published, with Python Code