0% found this document useful (0 votes)
20 views39 pages

SNS Lab File

Uploaded by

Mehnaaz Ansari
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)
20 views39 pages

SNS Lab File

Uploaded by

Mehnaaz Ansari
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/ 39

INDIRA GANDHI DELHI TECHNICAL UNIVERSITY FOR WOMEN,

KASHMERE GATE, DELHI 110006

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
2nd SEMESTER
2023-24
SIGNALS AND SYSTEM LAB FILE

SUBMITTED BY: SUBMITTED TO:


Mehnaaz Ansari Mr. Pankaj
07701182023
ECE-AI 2

1
INDEX
S.n Topic Date Remar Sig
o. ks n
1. Basic operation on matrices 29/01/2024

2. Write a program to generate various signals and 05/02/2024


sequences

3. Operations on signals 12/02/2024


4. Gibbs phenomenon 19/02/2024

5. Fourier transform, and inverse Fourier transform 26/02/2024

6. DTFT properties 01/04/2024

7. z-transform 08/04/2024

8. Correlation 08/04/2024

9. Convolution 15/04/2024

10. Gaussian Noise 15/04/2024

2
EXPERIMENT-1
BASIC OPERATIONS ON MATRICES
AIM:
To generate matrices and perform basic operations on matrices Using MATLAB Software.

THEORY:
MATLAB treats all variables as matrices. For our purposes, a matrix can be thought of as an
array that is how it is stored.
⦁Vectors are special forms of matrices and contain only one row OR one column.
⦁Scalars are matrices with only one row AND one column. A matrix with only one row AND
one column is a scalar. A scalar can be created in MATLAB as follows:
>>a_ value =23
⦁A matrix with only one row is called a row vector. A row vector can be created in MATLAB
as follows:
>> rowvec = [12 , 14, 63]
rowvec =12 14 63
⦁A matrix with only one column is called a column vector. A column vector can be created in
MATLAB as follows:
>> colvec = [13 ; 45 ; -21
colvec = 13 45 -2
⦁A matrix can be created in MATLAB as follows:
>> matrix =[ 1 ,2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9]
matrix =
123
456
789

Extracting a Sub-Matrix
A portion of a matrix can be extracted and stored in a smaller matrix by specifying the names
of both matrices and the rows and columns to extract. The syntax is:
sub_matrix-matrix (r1:r2.c1:c2);
Where r1 and r2 specify the beginning and ending rows and c1 and c2 specify the beginning
and ending columns to be extracted to make the new matrix.
● A column vector can be extracted from a matrix.

3
● As an example we create a matrix below:
>>matrix [1,2,3:4,5,6;7,8,9]
123
456
789
Here we extract column 2 of the matrix and make a column vector.
>>col_two= matrix(:, 2)
col two=
258
● A row vector can be extracted from a matrix. As an example we create a matrix below:
matrix= [1,2,3;4,5,6;7,8,9]
matrix=
123
456
789
● Here we extract row 2 of the matrix and make a row vector. Note that the 2:2 specifics
the second row and the 1:3 specifics which columns of the row.
>>rowvec=matrix (2:2,1:3)
rowvec=4 5 6

PROGRAM:
a) SCALAR DIVISION, MULTIPLICATION, ADDITION AND SUBTRACTION OF TWO
MATRICES USING COMMAND WINDOW.

4
b) SCALAR MULTIPLICATION, ADDITION, AND SUBTRACTION OF TWO
MATRICES USING SCRIPT MODE.

OUTPUT:

c) SCALAR DIVISION ,TRANSPOSE ,INVERSE AND DETERMINANT OF A MATRIX


USING SCRIPT MODE.

5
OUTPUT:

CONCLUSION:
In this experiment,basic operations on matrices using MATLAB have been demonstrated.

RESULT:
Basic operations on matrices using MATLAB have been verified.

6
EXPERIMENT-2
AIM:
To generate different types of signals Using MATLAB Software.

THEORY:
UNIT IMPULSE:
a) Continuous signal:

Also called unit impulse function. The value of delta function can also be defined in the sense
of generalised function.

b) Unit Sample sequence:

UNIT STEP FUNCTION:

7
b)Unit Step Sequence u(n):

SQUARE WAVES:
Like sine waves, square waves are described in terms of period,frequency and amplitude:

SAW TOOTH:
The sawtooth wave (or saw wave) is a kind of non-sinusoidal waveform. It is named a
sawtooth based on its resemblance to the teeth on the blade of a saw. The Convention is that a
sawtooth wave ramps upward and then sharply drops. However, there are also sawtooth

8
waves in which the wave ramps downward and then sharply rises. The latter type of sawtooth
wave is called a 'reverse sawtooth wave' or ‘inverse sawtooth wave'. As audio signals, the two
orientations of the sawtooth wave sound identical. The piecewise linear function based on the
floor function of time t, is an example of a sawtooth wave with period 1. A more general
form, in the range -1 to 1, and with period a, is this sawtooth function has the same phase as
the sine function. A sawtooth wave's sound is harsh and clear and its spectrum contains both
even and odd harmonics of the fundamental frequency. Because it contains all the integer
harmonics, it is one of the best waveforms to use for synthesising musical sounds,
particularly bowed string instruments like violins and cellos, using subtractive synthesis.

TRIANGLE WAVE:
A triangle wave is a non-sinusoidal waveform named for its triangular shape. A bandlimited
triangle wave pictured in the time domain (top) and frequency domain (bottom). The
fundamental is at 220 Hz (A2). Like a square wave, the triangle wave contains only odd
harmonics. However, the higher harmonics roll off much faster than in a square wave
(proportional to the inverse square of the harmonic number as opposed to just the inverse).It
is possible to approximate a triangle wave with additive synthesis by adding odd harmonics
of the fundamental, multiplying every (4n-1)th harmonic by -1 (or changing its phase by pi),
and rolling off the harmonics by the inverse square of their relative frequency to the
fundamental. This infinite Fourier series converges to the triangle wave:

SINUSOIDAL SIGNAL GENERATION:

9
The sine wave or sinusoid is a mathematical function that describes a smooth repetitive
Oscillation. It occurs often in pure mathematics, as well as physics, signal processing,
electrical engineering and many other fields. It's most basic form as a function of time (t) is:
where: • A, the amplitude, is the peak deviation of the function from its centre position. • w,
the angular frequency, specifies how many oscillations occur in a unit time interval, in
radians per second. u, the phase, specifies where in its cycle the oscillation begins at t = 0. A
sampled sinusoid may be written as: where f is the signal frequency, fs is the sampling
frequency, O is the phase and A is the amplitude of the signal. The PROGRAM and its
OUTPUT is shown below: Note that there are 64 samples with sampling frequency of 8000
Hz or sampling time of 0.125 mS (i.e. 1/8000).Hence the record length of the signal is
64x0.125=8mS. There are exactly 8 cycles of sine wave, indicating that the period of one
cycle is 1mS which means that the signal frequency is 1KHz.

SINC FUNCTION:
The sinc function computes the mathematical sinc function for an input vector or matrix x as
a function of time, or space, the sinc function is the inverse Fourier transform of the
rectangular pulse in frequency centred at zero of width 2 pi and height 1. The following
equation defines the sinc function.

PROGRAM:

10
OUTPUT:

11
PROGRAM:

OUTPUT:

12
PROGRAM:

OUTPUT:

13
PROGRAM:

OUTPUT:

14
EXPERIMENT-3
OPERATION ON SIGNALS
AIM:
Operations on signals such as addition, subtraction, multiplication, amplitude scaling, time
shifting, time scaling and time reversal.

THEORY:
Addition
Addition of two signals is nothing but addition of their corresponding Amplitudes.
Subtraction
Subtraction of two signals is nothing but subtraction of their corresponding Amplitudes.
Multiplication
Multiplication of two signals is nothing but multiplication of their corresponding Amplitudes.
Amplitude Scaling
C x (t) is an amplitude scaled version of x(t) whose amplitude is scaled by a factor C.
Time Shifting
x(t +- to) is the time shifted version of the signal x(t).
x (t + to) -›-› negative shift
x (t - to) ->-> positive shift
Time Scaling
x(At) is a time scaled version of the signal x(t), where A is always positive.
|A| > 1 -> -> Compression of the signal
|A| < 1 ->-> Expansion of the signal
Time Reversal
x(-t) is the time reversal of the signal x(t).

PROGRAM 1:

15
16
OUTPUT:

17
18
PROGRAM 2:

19
OUTPUT:

20
21
EXPERIMENT-4
GIBBS PHENOMENON
AIM:
To verify the Gibbs Phenomenon

THEORY:
The Gibbs phenomenon, the Fourier series of a piecewise continuously differentiable periodic
function behaves at a jump discontinuity. The n the approximated function shows number of
ripples at the points of discontinuity, this is known as the Gibbs Phenomenon. Partial sum of
the Fourier series has large oscillations near the jump, which might increase the maximum of
the partial sum above that of the function itself. The overshoot does not die out as the
frequency increases, but approaches a finite limit. The Gibbs phenomenon involves both the
fact that Fourier sums overshoot at a jump discontinuity, and that this overshoot does not die
out as the frequency increases Gibbs Phenomenon.

PROGRAM:

OUTPUT:

22
CONCLUSION:
In this experiment, gibbs phenomenon have been demonstrated using MATLAB.

23
EXPERIMENT-5
FOURIER TRANSFORM AND INVERSE FOURIER
TRANSFORM
AIM:
To find the Fourier Transform of a given signal and plot its magnitude and phase spectrum.

THEORY:
Fourier Transform Theorems:
We may use Fourier series to motivate the Fourier transform as follows. Suppose that f is a
function which is zero outside of some interval [-L/2, L/2] .Then for any T>=L we may
expand f in a Fourier series on the interval [-T/2,T/2), where the "amount of the wave e
2piink/T in the Fourier series of f is given by definition

DFT of a sequence:

Where N=Length of K= Frequency Coefficient


n= Samples in time domain.
FFT: Fast Fourier transformer.
There are Two methods.
1. Decimation in time (DIT FFT
2. Decimation in Frequency (DIF FFT)

24
PROGRAM 1:

OUTPUT:

PROGRAM 2:

OUTPUT:

PROGRAM 3:

25
OUTPUT:

FFT MAGNITUDE AND PHASE PLOT:

26
OUTPUT:

APPLICATIONS:
The no of multiplications in DFT = N2.
The no of Additions in DFT = N(N-1)
For FFT,
The no of multiplication = N/2 log 2N.
The no of additions = N log2 N.

CONCLUSION:
In this experiment the Fourier transform of a given signal and plotting its magnitude and
phase spectrum have been demonstrated using MATLAB.

27
EXPERIMENT-6
AIM:
To verify the properties of DTFT of a given discrete-time signal.

THEORY:
We will represent the spectrum of DTFT by X(e^jw)

DTFT Properties

Time shifting
If x (n) has a DTFT X (e^jw), then X(n - k) has a DTFT equal to e^-jwk X (e^jw), where k is
an integer. This is known as the time-shifting property.

Time reversal
X(-n) <-> X (e^-jw)

Convolution
Let x|n] <-> X(e) and h[n] <-> H(e^jw).
If y[ n] = x[n]* h[n], then
Y(e^jw) = X(e^jw)H(e^jw)

PROGRAM:

28
OUTPUT:

29
PROGRAM:

OUTPUT:

30
PROGRAM:

OUTPUT:

31
EXPERIMENT -7
Z TRANSFORM
AIM:
To find the Z Transform of equations.

THEORY:
Z transform is used to convert discrete time signals into the frequency domain. Discrete time
signal includes real as well as imaginary values (Complex numbers). In Matlab, trans
function is used to find the z transform of any signal. We can pass one, two, or three
arguments through trans function. Mathematically it performs just like Laplace transform,
which is a discrete-time representation of Laplace transform's transform is also used to plot
poles and zeros which are important to represent regions of interest. Z transform helps to
perform analysis of linear time invariant systems or signals. It covers complex differential
equations into simple mathematical equations. It can be unilateral or bilateral. If z transform
is unilateral then it assumes a range between zero to infinity and if z transform is bilateral
then the range is between minus infinity to plus infinity.

PROGRAM:

OUTPUT:

PROGRAM:

OUTPUT:

32
PROGRAM:

OUTPUT:

CONCLUSION:
In this experiment, Z transform has been demonstrated using MATLAB.

33
EXPERIMENT-8
CORRELATION
AIM:
Performing correlation on signals.

THEORY:
Correlation:
Correlation is a measure of similarity between two signals. The general formula for
correlation is

There are two types of correlation:


● Autocorrelation
● Cross correlation

PROGRAM:

34
OUTPUT:

PROGRAM:

35
OUTPUT:

36
EXPERIMENT-9
CONVOLUTION
AIM:
Performing convolution in signals.

THEORY:
Convolution:
Convolution is a mathematical operation used to express the relation between input and
output of an LTI system. It relates input, output and impulse response of an LTI system as
y(t)=x(t)*h(t)y(t)=x(t)*h(t)
Where,
y(t) = output of LTI
x(t) = input of LTI
h(t) = impulse response of LTI
There are two types of convolutions:
● Continuous convolution
● Discrete convolution

PROGRAM:
Linear Convolution:

37
OUTPUT:

38
EXPERIMENT-10
GAUSSIAN NOISE
AIM:
To perform gaussian noise.

THEORY:

PROGRAM:

OUTPUT:

39

You might also like