Assignment 1 Signals

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 31

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.

Code snippet:
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
Code snippet:
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+2)/ (√5-1)

b) q = log (e^5) + log10 (10^2)

c) r = sin^2(pi/6)+cos^2(pi/6)

d) s =(1+5i)/(1-5i)

e) w = e^jπ/4 and

f) u = e^π/2j.

Code snippet:
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.


Code snippet:

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)

Code snippet:
Output:
B. Generation of sequences- I
Question 6:

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.


Code snippet:
Output:
C. Generation of sequences- II
Question 7:

Generate impulse, step, and ramp signals (continuous time & discrete time) using:

a. Logical operations

b. Function files.
Code snippet:

a) Logical operations
b)Function files
Code snippet:
D. Basic operation on signals
Question 8:

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)


Code snippet:
9)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
Code snippet:
E.Convolution
Question 10:

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]

Code snippet:
Question 11:

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.

Code snippet:

OUTPUT:-
Question 12:

Code snippet:
OUTPUT:-

You might also like