You are on page 1of 27

NOV|2023

Signals and Systems Assignment


19ECE203: Signals and Systems

Submitted by

BL.EN.U4ECE22022 Emani Sandeep Reddy

in partial fulfillment for the award of the degree

of

BACHELOR OF TECHNOLOGY

IN
“ELETRONICS AND COMMUNICATION”
ENGINEERING

NOVEMBER-2023

AMRITA VISHWA VIDYAPEETHAM


AMRITA SCHOOL OF ENGINEERING, BENGALURU, 560035

Department of ECE, ASE, Bengaluru


A. Introduction to MATLAB
1. a) Create a row vector x with elements 1, 2, 9, -2, 4, 3, -6, and a column vector y with the same sequence
of elements.
b) Use length(x) and find the length of vector x
c) Find the transpose of x and y. What do you observe?
d) Find x.*x
Ans:-

Code:-

Output:-

2. Create two 3×3 matrices A and B with elements (1 4 1; 2 3 4; -1 6 7) and (7 4 2;3 5 6; -1 2 1) and
determine the following.
a) A + B
b) A.*B
c) A*B
d) A(:, 3)
e) B(1:2, : )
f) AT + 2BT
Ans:-
Code:-

Output:-

3. Explore the in-built functions sqrt, sin, cos, exp, log10, log, in MATLAB and use them to compute the
following:
a) p=2*((3^(1/2)+2)/(5^(1/2)-1))
b) q = log(exp(5)) + log10(10^2)
c) r = sin(pi/6)^2 + cos(pi/6)^2
d) s = (1 + 5i) / (1 - 5i)
e) w = exp(1i*pi/4)
f) u = exp(pi/2*1i)

Ans:-
Code:-

Output:-

4. Create a vector t = 0:0.001:2 , find x1 = sin(2π10t) and x2 = cos(2π20t).


a) Plot the signals x1 and x2 versus t in two figure windows. (Hint: Use commands plot, xlabel, ylabel)
b) Plot the signals x1 and x2 versus t in the same figure window. (Hint: Use commands subplot, plot)

Ans:-
Code:-

Output:-
5. Explore the working following built-in functions in MATLAB (submit code showing how each of the
functions is to be used and show output) abs(x), cos (x), sin(x), tan(x), ceil(x), fix(x), floor(x), round(x),
char(x), eye(), ones(), zeros(), real(x), mag(x)
Ans:-
Code:-

Output:-
B. Generation of Sequences – I
Generate the following signals and plot them using MATLAB.
a. A continuous-time sinusoidal signal, x(t) = 2sin(2πt+φ) for 0 ≤ t ≤ 4 for phase, φ = 0 and π.
b. A discrete-time sinusoidal signal with a fundamental period N=10, for -20 ≤ n ≤ 20.
c. A rectangular pulse with a pulse width of 2.
d. A triangular waveform with a time-period of 0.5 sec for -2 ≤ t ≤ 2, with peak value occurring at p = 0.8.
e. A continuous-time exponential waveform, y(t) = e-t, 0 ≤ t ≤ 5 and a discrete time exponential signal, x[n]
= an, where a = 0.8 and 0 ≤ n ≤ 25.
Hint: Use functions sin(), rectpuls(), sawtooth(), exp(), stem(), figure(), plot(), legend(), xlabel(), ylabel(),
subplot(), grid(), etc.
Ans:-
a. A continuous-time sinusoidal signal, x(t) = 2sin(2πt+φ) for 0 ≤ t ≤ 4 for phase, φ = 0 and π.
Code:-

Output:-

b. A discrete-time sinusoidal signal with a fundamental period N=10, for -20 ≤ n ≤ 20.
Code:-

Output:-

c. A rectangular pulse with a pulse width of 2.


Code:-

Output:-
d. A triangular waveform with a time-period of 0.5 sec for -2 ≤ t ≤ 2, with peak value occurring at p = 0.8.
Code:-

Output:-

e. A continuous-time exponential waveform, y(t) = e-t, 0 ≤ t ≤ 5 and a discrete time exponential signal, x[n]
= an, where a = 0.8 and 0 ≤ n ≤ 25.
Code:-
For continuous-time
For discrete time

Output:-
For continuous-time

For discrete time


C. Generation of Sequences - II
Generate impulse, step, and ramp signals (continuous time & discrete time) using:
a. Logical operations
b. Function files.
Ans:-
a. Logical operations
Code:-

Output:-
For continuous-time
For discrete time

b. Function files.
Code:-
For continuous-time
For discrete time
Output:-
For continuous-time

For discrete time


D. Basic operations on signals
1. Generate a signal x(t) = 3sin(10πt)e-5t for 0 ≤ t ≤ 2, and perform the following operations:
(a) y1(t) = x(–t)
(b) y2(t) = x(t–3)
(c) y3(t) = x(t+2)
(d) y4(t) = x(t/2)
(e) y5(t) = x(2t)
Hint: Use commands as subplot(), plot(), legend(), axis(), grid(), etc.
Ans:-

Code:-
Output:-
2. Verify whether the following signals are even, odd or neither even nor odd, by decomposing the signals
into their even and odd components. For each signal, generate a figure window and plot the signal, it’s even
and odd parts using subplots.
(a) x1(t) = 5cos[(π/8)t]
(b) x2(t) = 4sin[(π/6)t]
(c) x3(t) = e-2t for 0 ≤ t ≤ 2.
Ans:-
Even Signal:( x_e(t) = 1/2[x(t)+x(−t)]
Odd Signal:( x_o(t) =1/2[x(t)-x(−t)]
(a) x1(t) = 5cos[(π/8)t]
x1(-t)= 5cos[-(π/8)t]= 5cos[(π/8)t](cosine is an even function)
x1e(t)= 1/2[5cos[(π/8)t] + 5cos[-(π/8)t] ]= 5cos[(π/8)t] (even)
x1o(t)= 1/2[5cos[(π/8)t] - 5cos[-(π/8)t] ]= 0 (odd)
So, ( x1(t) ) is an even signal.
(b) x2(t) = 4sin[(π/6)t]
x2(-t)= 4sin[-(π/6)t]=- 4sin[(π/6)t](sine is an odd function)
x2e(t)= 1/2[4sin[(π/6)t]+ 4sin[-(π/6)t]]= 0 (even)
x2o(t)= 1/2[4sin[(π/6)t] - 4sin[-(π/6)t]]= 4sin[(π/6)t] (odd)
So, ( x2(t) ) is an odd signal.
(c) x3(t) = e-2t for 0 ≤ t ≤ 2.
Since ( x3(t) ) is a decaying exponential function, it is neither even nor odd.
In summary:
( x1(t) ) is an even signal.
( x2(t) ) is an odd signal.
( x3(t) ) is neither even nor odd.
Code:-
Output:-

E. Convolution
1. Find the output of an LTI system characterized by impulse response h[n] = [1, 2, -1, 2, 3, -4,], when the
input signal is x[n] = [1, 0.5, -1, 3, -6, 4, 3, 5]. Numbers in bold are signal values at the time origin n = 0.
Use subplot to plot the input signal x[n], impulse response h[n], and output signal y[n].
Ans:-
Code:-
Output:-

>> E1

x = 1.0000 0.5000 -1.0000 3.0000 -6.0000 4.0000 3.0000 5.0000

h= 1 2 -1 2 3 -4

y = 2.5000 5.0000 -15.5000 18.0000 8.0000 -15.0000 37.0000 3.0000

n_x = 0 1 2 3 4 5 6 7

n_h = 0 1 2 3 4 5

n_y = 0 1 2 3 4 5 6 7

>>

2. Find y(t) = x(t) * h(t) with x(t) = u(t) – u(t-4) and h(t) = u(t+2) – u(t-2), t = -10:10. Use subplot to plot the
input signal, impulse response of the system, and output signal
Ans:-
Code:-

Output:-
3. Find y(t) = x(t) * h(t) where x(t) and h(t) are as shown below. Use subplot to plot input signal x(t),
impulse response of the system h(t) and output signal

Ans:-

Code:-
Output:-

You might also like