I am using the below codes so as to plot the dead band for a sine wave so that the dead band appears on the x axis as y=0. The output is minimized by the value of upper limit[y-0.5] and the lower limit.The dead band needs to be displayed here.Could any one help me in this.
import matplotlib.pyplot as plt
import numpy as np
UpperLimit = 0.5;
LowerLimit = -0.5;
x=np.linspace(-20,20,100);
y=np.sin(x);
if y < 0:
y=np.sin(x)-LowerLimit
if y > 0:
y=np.sin(x)-UpperLimit
else:
y=0
plt.plot(x,y)
plt.grid()
plt.show()
