Computer Assignment 1 19ECE203 Signals and Systems
Computer Assignment 1 19ECE203 Signals and Systems
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.
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
3. Explore the in-built functions sqrt, sin, cos, exp, log10, log, in MATLAB and use them to
compute the following:
√"#$ ( ( '#%*
a) p = 2 b) q = log (e5) + log10 (102) c) r = sin2 ( ) ) + cos2 ( ) ) d) s = '&%*
√%&'
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)
C. Generation of Sequences - II
Generate impulse, step, and ramp signals (continuous time & discrete time) using:
a. Logical operations
b. Function files.
1. Generate a signal x(t) = 3sin(10πt)e-5t for 0 ≤ t ≤ 2, and perform the following operations:
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.
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].
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.
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.
x(t)
h(t)
*
1
1
t t
-1/2 1/2 -1 1