Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Military Institute of Science and Technology (MIST)

Department of Biomedical Engineering


_________________________________________________________________________
Sessional Title
Experiment on sampling, quantization, and representation of different Biosignals
Objectives:
1. To familiarize with sampling, quantization, and representation of some well-known biosignals
2. To get a hands on experience of sampling and quantizing the biosignals
3. To introduce with the aliasing effect and the quantization error

1. Let’s learn about basic digital signals


Followings are the list of basic digital signals to generate any other digital signal
S.N. Function Equation Parameters
1 if n  0 n   N / 2,..., N / 2
1 Dirac (unit impulse) (n)  
0 otherwise N  10
n   N / 2,..., N / 2
2 Unit step x(n)  2u (n)  1
N  10
n   N / 2,..., N / 2
3 Sign rect(n)  (n  M )  u(n  M )
N  10
n  0,..., L  1
4 Rectangle x(n)  x0 sin( 2f 0 nTs ) L  20
f 0  100Hz,1 / Ts  f s  1KHz
1 for n  0 n   L,..., L
 L  50
5 sinc or sine cardinal x(n)   sin( nTs )
 nT otherwise
 s Ts  0.1sec

Let’s do practice:
Type in Matlab Response by Matlab
% Dirac Function
N = 10; % number of samples
n = -N/2:N/2; % vector
d = [zeros(1,N/2) 1
zeros(1,N/2)];
figure; % display
stem(n,d);
xlabel('n');
ylabel('\delta(n)');
title('Dirac function');
axis([-N/2 N/2 0 1.1]);
grid on
% Unit step function
N = 10; % number of samples
n = -N/2:N/2; % vector
u = [zeros(1,N/2) 1
ones(1,N/2)];
figure; % display
stem(n,u);
xlabel('n');
ylabel('u(n)');
title('Unit step function');
axis([-N/2 N/2 0 1.1]);
grid on

-------------------------------------------------------------------------------------------------------------------------------------------
Prepared by: Dr. Md. Asadur Rahman, Assistant Professor, Dept of Biomedical Engineering, MIST
Military Institute of Science and Technology (MIST)
Department of Biomedical Engineering
_________________________________________________________________________

Type in Matlab Response by Matlab


% Sign function
N = 10; % number of samples
n = -N/2:N/2; % vector
u = [zeros(1,N/2) 1
ones(1,N/2)];
x = 2.*u-1;
figure; % display

stem(n,x);
xlabel('n');
ylabel('x(n)');
title('Sign function');
axis([-N/2 N/2 -1 1]);
grid on

% Rect function
M = 3;
N = 10; % number of samples
n = -N/2:N/2; % vector
Rect = [zeros(1,N/2-M)
ones(1,2*M+1) zeros(1,N/2-
M)];
figure; % display
stem(n,Rect);
xlabel('n');
ylabel('rect');
title('Rect function');
axis([-N/2 N/2 0 1.1]);
grid on

% Sine function
L = 20;
n = 0:L-1;
f0 = 100; %initial frequency
fs = 1000; %sampling
frequency
x0 = 1;
x = x0*sin(2*pi*f0/fs*n);
%sine function description
figure; % display
stem(n,x);
xlabel('n');
ylabel('sin');
title('Sine');
axis([-1 L -1.1 1.1]);

-------------------------------------------------------------------------------------------------------------------------------------------
Prepared by: Dr. Md. Asadur Rahman, Assistant Professor, Dept of Biomedical Engineering, MIST
Military Institute of Science and Technology (MIST)
Department of Biomedical Engineering
_________________________________________________________________________

Type in Matlab
% Sinc function
L = 50;
n = [-L:L];
Ts = 0.1;
x = zeros(1,length(n));
x(n~=0) = sin(pi*n(n~=0)*Ts)./(pi*n(n~=0)*Ts); %logic for sinc
x(n==0) = 1;
figure; % display
stem(n,x);
xlabel('n');
ylabel('sin');
title('Sinc function');

Try c=a+b; and comment on the result

2. Sampling a continuous Biosignal:


i). Load a biosignal like ECG
ii). Show them as continuous and discrete representation
iii). Represent them as a predefined spaced discrete format
iv). Increase and decrease the sampled space and observe the effect of this type of sampling
v). Develop a concept on aliasing effect from the previous figures

-------------------------------------------------------------------------------------------------------------------------------------------
Prepared by: Dr. Md. Asadur Rahman, Assistant Professor, Dept of Biomedical Engineering, MIST

You might also like