# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/ananthapadmanabhan-o/Learn-Coding/blob/master/signals_and_systems.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + [markdown] id="3AjJNo0dZG06"
#
#                                                                                       
#                                                               
# ##                                                                        Signals and Systems         
#                                                                                   
#
#
#
#

# + [markdown] id="-BC1P-40TMuh"
# **a.Impulse Sequence**

# + colab={"base_uri": "https://localhost:8080/", "height": 350} id="oV9DX81fTFiC" outputId="4f56049e-1863-44c5-e653-22a367ea30e5"
from numpy import*
from pylab import*
x=array ([-3,-2,-1,0,1,2,3])
y=array ([0,0,0,1,0,0,0])
stem(x,y)
xlabel ("<-   n   ->")
ylabel ("Amplitude")
title ("Impulse Sequence")
grid ("on")
show()

# + [markdown] id="1_PXY59xUTHM"
# **b.Unit Step Sequence**
#

# + colab={"base_uri": "https://localhost:8080/", "height": 350} id="0MyJW8O3UZvX" outputId="abd686b6-e5e5-4d47-a835-06a4d6a3bf5f"
from numpy import*
from pylab import*
x=array([-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10])
y=array ([0,0,0,0,1,1,1,1,1,1,1,1,1,1,1])
stem(x,y)
xlabel ("<-        n        ->")
ylabel ("Amplitude")
title ("Unit Step Sequence")
grid ("on")
show ()

# + [markdown] id="wZnTWthqUeUp"
# **c.Pulse Signal**

# + colab={"base_uri": "https://localhost:8080/", "height": 295} id="kslrvjP0Ukfb" outputId="1c95f6ed-3051-4115-c39a-069607560ca8"
#Pulse Signal
from numpy import*
from pylab import*
y=array ([0,0,1,1,1,0,0])
x=array ([-30,-15.001,-15,0,15,15.001,30])
plot(x,y)
xlabel ("<-  t  ->")
ylabel ("Amplitude")
title ("Pulse Signal")
grid ("on")
show ()

# + [markdown] id="ywESX6Vxpkuy"
#

# + [markdown] id="3CO4U_phpke4"
#

# + colab={"base_uri": "https://localhost:8080/", "height": 628} id="OJGBejNLUzhS" outputId="b07bb0d5-0152-45d3-8e6e-2242e9c14f02"
from numpy import*
from pylab import*
x=array ([0,1,2,3,4,5,6,7,8,9,10])
y=array ([0,1,2,3,4,5,6,7,8,9,10])
figure (1)
plot (x,y)
title ("Ramp Signal")
xlabel ("Time  t->")
ylabel ("Amplitude")
grid ('on')
figure (2)
stem (x,y)
title ("Ramp Sequence")
xlabel ("No.of Samples")
ylabel ("Amplitude")
grid ('on')
show ()

# + [markdown] id="8kDaBMz4U5ae"
# **e.Sine Wave**

# + colab={"base_uri": "https://localhost:8080/", "height": 364} id="QOdz7MFmVA32" outputId="845f7669-631a-4169-bd2e-8d0f576809eb"
from numpy import*
from scipy import*

t=arange(0,2,0.001)
f=1000
a=10
y=a*sin(2*3.14*f*t)
title("Sine Wave")
xlabel('time')
ylabel('Amplitude')
plot(t,y)
grid('on')
show()





# + [markdown] id="O4NUc0QSVGVz"
# **2.Convolution**

# + colab={"base_uri": "https://localhost:8080/", "height": 933} id="Kxc8rUG7VVaC" outputId="7cefd9a1-2135-403d-b543-7dcc52d87d1a"
import numpy as np
from pylab import*
x=np.array([1,2,3])
h=np.array([1,0,1])
y=np.convolve(x,h)
figure (1)
title ('x(n)')
stem (x)
grid ('on')
figure (2)
title ('h(n)')
stem (h)
grid ('on')
figure (3)
title ('y(n)')
stem (y)
grid ('on')
show ()

StarcoderdataJupyterScriptsDedupFiltered