0% found this document useful (0 votes)
24 views31 pages

6 10

The document discusses computing and plotting the impulse response of linear time-invariant systems. It defines linear and time-invariant systems, and explains that the impulse response completely characterizes such a system. The lab tasks involve determining the impulse response of example systems and plotting the results.

Uploaded by

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

6 10

The document discusses computing and plotting the impulse response of linear time-invariant systems. It defines linear and time-invariant systems, and explains that the impulse response completely characterizes such a system. The lab tasks involve determining the impulse response of example systems and plotting the results.

Uploaded by

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

HITEC UNIVERSITY

DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 1

CLO 1 Date

Experiment 06: To be able to use the in-built MATLAB


functions

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 6
To be able to use the in-built MATLAB functions

Singularity functions:
Unit step

 H=heaviside(t);
Ramp function

 ramp=(t).*heaviside(t);
Impulse function

 Impulse=dirac(t);

 i=(Impulse==inf);

 Impulse(i)=1;
Time Reversal:

 y1=fliplr(y);

 n_y=-fliplr(n);
Square wave:

 fs=1000;

 f=3;

 t=0:1/fs:1-1/fs;

 x=2*square(2*pi*f*t);
Sawtooth wave:

 x=sawtooth(f*t,0.5);

Lab Tasks:
 Generate signals using all the in-built commands and functions, as performed in lab.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 07: To compute and plot the Complex


Exponential function

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 7
To compute and plot the Complex Exponential function
Objective:
In this lab, we will cover the following topics:

 Gain familiarity with Complex Numbers and plot them


 Complex exponential signals
 Real exponential signals

COMPLEX NUMBERS
A complex number z is an ordered pair (x, y) of real numbers. Complex numbers can be
represented in rectangular form as z = x + iy, which is the vector in two-dimensional plane. The
horizontal coordinate x is called the real part of z and can be represented as x = Re {z}, while the
vertical coordinate y is called the imaginary part of z and represented as y = Imag {z}. That is:
z = (x, y)
= x + iy
= Re {x} + i Imag {x}

BUILT-IN MATRIX FUNCTIONS


Function Description
==================================================
real returns the real part x of z
imag returns the imaginary part y of z
abs returns the length r of z
angle returns the direction θ of z
conj returns the complex conjugate of z
==================================================

Example
To define the complex number, for instance, z = (3, 4) in matlab write in matlab
editor >> z = 3 + 4i
z=
3.0000 + 4.0000i

Example
To find the real and imaginary parts of the complex number,
write >> x = real(z)
x=
3
>> y = imag(z)
y=
4

Example:
clear, close all, clc
n=0:1/10:10;
k=5;
a=pi/2;
x=k * exp(a*n*i);
% plot the real part
subplot(2,1,1)
stem(n, real(x), 'filled')
title('Real part of complex exp')
xlabel('sample #')
ylabel('signal amplitude')
grid
% plot the imaginary
part subplot(2,1,2)
stem(n, imag(x), 'filled')
title('Imaginary part of complex exp')
xlabel('sample #')
ylabel('signal amplitude')
grid
Lab Tasks:
Generate and plot the following exponential function in MATLAB.

 X=

Plot the real, imaginary, magnitude and phase of the following function.

HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 3

CLO 2 Date

Experiment 08: OPEN ENDED LAB (To perform smoothing of


the data)

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:
Instructor’s Sign
EXPERIMENT 8
To perform smoothing of the data
Objective:
 To be able to perform smoothing of a noisy signal.

Generation of Random Noise signal: X = rand(n)


 rand(n) creates an n-by-n distributed matrix of uniformly distributed random numbers. Each
element in in the variable is between 0 and 1.
When you create the distributed array in a communicating job or spmd block, the function
creates an array on each worker. If you create a distributed array outside of a communicating
job or spmd block, the array is stored only on the worker or client that creates the distributed
array.
By default, the distributed array has the underlying type double.
 rand(___, datatype) creates a distributed array of uniformly distributed random numbers with
the underlying type datatype. For example, rand(distributed(1),"single") creates a distributed
single-precision random number. You can use this syntax with any of the input arguments in the
previous syntaxes.
Underlying data type of the returned array, specified as one of these options:
 "double"
 "single"
 "logical"
 "int8"
 "uint8"
 "int16"
 "uint16"
 "int32"
 "uint32"
 "int64"
 "uint64"

Examples:
Generating a random noise signal:

 % Random signal
 t=0:0.01:3;
 f=1;
 lv=-1;
 uv=1;
 y=lv+(uv-lv)*rand(1,length(t));
 z=sin(2*pi*f*t);
 a=y+z;
 figure
 plot(t,a)
 grid on
Generating a noisy sinusoidal signal:

 t=0:0.001:1;
 f=2;
 x=sin(pi*f*t)+0.5*(-1+(1+1)*rand(1,length(t)));
 subplot(211)
 plot(t,x)
 h=ones(1,10);
 y=conv(x,h);
 subplot(212)
 plot(y)

Lab tasks:

1. Plot a noisy sinusoidal signal with frequency of 5Hz, 0<t<1. The step size should be 0.001s.
2. Plot the smoothed sinusoidal signal, after performing convolution with a unit step signal of high
value.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 09: To compute and plot the Impulse Response


of a system

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 9
To compute and plot the Impulse Response of a system
Objective:
 To learn to compute the impulse response of a system

Linear time-invariant systems:


Linear time-invariant systems (LTI systems) are a class of systems used in signals and systems that
are both linear and time-invariant. Linear systems are systems whose outputs for a linear
combination of inputs are the same as a linear combination of individual responses to those inputs.
Time-invariant systems are systems where the output does not depend on when an input was
applied. These properties make LTI systems easy to represent and understand graphically.
LTI systems are those that are both linear and time-invariant.

Linear systems have the property that the output is linearly related to the input. Changing the input in a
linear way will change the output in the same linear way. So if the input x1 ​(t) produces the
output y1(t) and the input x2​(t) produces the output y2​(t), then linear combinations of those inputs will
produce linear combinations of those outputs. The input (x1​(t)+x2​(t)) will produce the
output (y1​(t)+y2​(t)). Further, the input (a1​⋅x1​(t)+a2​⋅x2​(t)) will produce the output (a1​⋅y1​(t)+a2​⋅y2​(t)) for
some constants a1​ and a2​.

In other words, for a system T over time t, composed of signals x1​(t) and x2​(t) with
outputs y1​(t) and y2​(t),

T[a1​x1​(t)+a2​x2​(t)] =a1​T[x1​(t)] +a2​T[x2​(t)]=a1​y1​(t)+a2​y2​(t),

where a1​ and a2​ are constants.

Further, the output of a linear system for an input of 0 is also 0.

Time-invariant systems are systems where the output for a particular input does not change depending
on when that input was applied. A time-invariant system that takes in signal x(t) and produces
output y(t) will also, when excited by signal x(t+σ), produce the time-shifted output y(t+σ).

Impulse Response:
Thus, the entirety of an LTI system can be described by a single function called its impulse response.
This function exists in the time domain of the system. For an arbitrary input, the output of an LTI system
is the convolution of the input signal with the system's impulse response.

Example:
num=ones(1,3); % all values in the input (X)
den=[1 2 3 5]; % all values in the output (Y)
y=filter(num,den,xn);
y1=impz(num,den,length(t),fs); %impulse response

Lab Task:
(a) Determine the impulse response g(n) of the stable inverse of H(z).

(b) Generate a noisy sinusoidal signal. Perform its convolution with the impulse response.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 10: To find the Laplace-Transform and inverse


Laplace transform of the system

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 10
To find the Laplace-Transform and inverse Laplace transform of the
system
Objective:
Upon successful completion of this experiment student will be able to:
 Calculate the Laplace of function

Laplace transform:
Syntax:

f=t;
F=laplace(f)
F=
1/sˆ2
F2=laplace(f)
F2=
1

f=heaviside(t);
F=laplace(f)
F=
1/s
Conclusion:
Summarize, in a paragraph or two, what you conclude from the results of your experiment and whether
they are what you expected them to be. Compare the results with theoretical expectations and include
percent error when appropriate. Don’t use terms such as "fairly close" and "pretty good;" give explicit
quantitative deviations from the expected result. Evaluate whether these deviations fall within your
expected errors and state possible explanations for unusual deviations. Discuss and comment on the
results and conclusions drawn, including the sources of the errors and the methods used for estimating
them.
Lab task:
Perform the Laplace transformation of the following, using ‘laplace’ function:
1.
2.
3.
4.
5.
6.
Verify the signals mentioned in the previous slide, by taking their inverse Laplace Transform. Using the
function ‘ilaplace’.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 11: To plot the discrete Fourier transform of


signals using functions

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 11
To plot the discrete Fourier transform of signals using functions

Objective:
 To find Discrete Fourier Transform and Inverse Discrete Fourier Transform of given digital signal.

THEORY:
Basic equation to find the DFT of a sequence is given below:

Algorithm:
Step I: Get the input sequence.
Step II: Find the DFT of the input sequence using direct equation of DFT.
Step IV: Plot DFT of the given sequence using MATLAB command stem.
Step V: Display the above outputs

Program:
Function:
function X=myDFT(x,N)
L=length(x);
if (N<L)
('N must be greater or equal to length of X');
end
x=[x zeros(1,N-L)];
X=zeros(1,N);
for k=0:N-1
for n=0:N-1
X(k+1)=X(k+1)+x(n+1)*exp(-j*(2*pi/N)*k*n);
end
end
end
fs=500;
t=0:1/fs:1-1/fs;
f1=10;
x=5*sin(2*pi*f1*t);
N=length(x);
X=myDFT(x,N);
X=2/N*X;
X=fftshift(X);
fx=linspace(-fs/2,fs/2,N);
subplot(311)
plot(t,x)
subplot(312)
stem(fx,abs(X))
subplot(313)
plot(fx,angle(X))

% Discrete Fourier transform:


X?
N = length(x);
X = zeros(1,4)
for k = 0:N-1
for n = 0:N-1
X(k+1) = X(k+1) + x(n+1)*exp(-j*pi/2*n*k)
end
end

t = 0:N-1
subplot(311)
stem(t,x);
title('Time domain - Input signal')

Lab tasks:
1. X=[2 3 -1 4], t=0:N-1;
2. X(n)= , t=0:500. Add to more signals with this.
3. X(n)=, t=0:500.
4. X(n)=[1 4 9 16 25 36 49 64 81], N= 9.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 12: To find the transfer function of the system

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 12
To find the transfer function of the system
Objective:
 To learn to find the transfer function.
Transfer function:
A transfer function is a mathematical representation of the relationship between the input and
output of a system. It describes how the output of a system changes in response to different
inputs. For example, the transfer function of a filter can describe how the filter modifies the
frequency content of a signal. The transfer function is a complex function, typically represented
in the frequency domain, and it can be used to predict the behavior of a system.

The transfer function ( ) of an LTI system can be defined in one of the following ways −
 The transfer function of an LTI system is defined as the ratio of the Fourier transform of
the output signal to the Fourier transform of the input signal provided that the initial
conditions are zero.
 Or, the transfer function is defined as the ratio of output to input in frequency domain
when the initial conditions are neglected.
 Or, the transfer function of the LTI system is the Fourier transform of its impulse
response.
Mathematically, the transfer function of LTI system in frequency domain is defined as,
H(ω)=Y(ω) / X(ω)
 ‘s’ domain:
H(s) =
 ‘z’ domain:
H(z) =

H(z) = =
Lab tasks:
Find out the transfer functions of the following:

H(z) =
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 13: To plot the signals spectra using fast Fourier


transform

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 13
To plot the signals spectra using fast Fourier transform
Objective:
 To find Discrete Fourier Transform and Inverse Discrete Fourier Transform of given
digital signal.
THEORY:
Basic equation to find the DFT of a sequence is given below:

The FFT algorithm is used to convert a digital signal (x) with length (N) from the time domain
into a signal in the frequency domain (X), since the amplitude of vibration is recorded on the
basis of its evolution versus the frequency at that the signal appears.
Program:
 N=length(x);
 X=2/N*fft(x,N);
 % X=fftshift(X);
 mag=abs(X);
 phase=angle(X);
 fx=linspace(0,fs/2,N/2);
 plot(fx,mag(1:N/2);

Lab Tasks:
1. Create a sine wave of frequency 100 Hz. Set the sampling frequency to 1000. Adjust the
time period according to sampling frequency.
2. Take the Fourier transform the above generated sine wave using ‘fft’ command. And plot
the signal.
HITEC UNIVERSITY
DEPRATMENT OF BIOMEDICAL ENGINEERING

Program Biomedical Engineering Semester 4th

Subject EE-302L Signals and Systems Lab Level of Enquiry: 2

CLO 2 Date

Experiment 14: To plot the frequency response of the system

Lab
Lab report Lab Viva
performance
Ability to Calculations Level of understanding
Conduct and Data of the learned skill
Experiment Presentation

Remarks:

Instructor’s Signature:
EXPERIMENT 14
To plot the frequency response of the system
Objective:
 To compute the frequency response of the system
Theory:
Consider a causal discrete-time LTI system implemented using the difference equation,
y(n) = 0:1 x(n) – 0.1176 x(n - 1) + 0.1 x(n - 2) + 1.7119 y(n - 1) – 0.81 y(n - 2)
For convenience, the frequency response of the system, H(ejω), is sometimes denoted Hf (ω).
1. What is the transfer function H(z) of the system? (Not a MATLAB question!)
2. Plot the magnitude of the frequency response Hf (ω) of the system using the MATLAB
command frequency:
>> [H,w] = freqz(b,a);
>> plot(w,abs(H));
where b and a are appropriately defined.
Program:
 fs=1000;
 H1=freqs(num,den,w);
 [H1,w]=freqz(num,den,256,fs)
 mag=20*log10(abs(H1));
 phase=angle(H1)*180/pi;

Lab tasks:
Compute the frequency responses of the following:



You might also like