0% found this document useful (0 votes)
10 views8 pages

Exp 6

Uploaded by

kashyapayush786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Exp 6

Uploaded by

kashyapayush786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Experiment 6

 Aim: Write a Python and MATLAB code to perform convolution without using “conv”
function.
 Software used: MATLAB_R2024a software and Python Compiler
 Theory: For discrete signals, x[n] and h[n], convolution is mathematically defined as:
y(n) = x(n) * h(n)

y(n) = ∑ x ( k ) . h(n−k)
k=−∞

 MATLAB Code:
Output:

 Python Code:
Output:

 Result: The convolution of two discrete signals has been obtained without using conv()
function
Experiment 7
 Aim: Write a program to develop Fourier series of square wave and sawtooth wave in
MATLAB and python.
 Software used: MATLAB_2024a and Python software.
 Theory:
A periodic function can be expressed as a sum of an infinite number of sine and cosine
functions, which is known as its Fourier series representation.
For a square wave with a period Tand amplitude A, the Fourier series is given by:
f ( t )=
4A
π ( )
(sin
πt 1
+ sin
T 3 ( )
3 πt 1
T
+ sin
5 ( )
5 πt
T
+ … .)

For a sawtooth wave, the Fourier series is slightly different. A sawtooth wave with a
period T and amplitude A can be represented as:
f ( t )=
2A
π ( )
(sin
2 πt 1
T
− sin
2 ( )
4 πt 1
T
+ sin
3 ( )
6 πt
T
+ … .)

 MATLAB code:
a) Square Wave
Output:

b) Sawtooth Wave
Output:

 Python Code:
a) Square Wave
Output:

b) Sawtooth Wave
Output:

 Result: The approximate graphs of Square Wave and Sawtooth wave using Fourier Series
has been obtained.
 Discussion: The trigonometric Fourier Series Approximation is used to derive the
approximate graphs of the Square Wave and Sawtooth Wave. As we further increase the
harmonics, the graphs come closer to its original form.

You might also like