Professional Documents
Culture Documents
LAB: Sampling: University of Engineering and Technology Lahore Department of Mechatronics and Control Engineering
LAB: Sampling: University of Engineering and Technology Lahore Department of Mechatronics and Control Engineering
LAB: Sampling
OBJECTIVE:
To become familiar with sampling of different signals in MATLAB
TASKS:
Generate three different signals (sampling & square) and plot them separately with some sampling
time. Then increase the sampling time such that all three signals look same i.e. the aliasing factor.
Take a sin signal find its highest digital frequency.
COMMANDS:
square, sin, triplus, subplot, stem.
Comments:
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
________________________________________________________________________________________________________________________________
TASK CODE:
Code 1:
clc,clear,close
t=0:0.1:9; 11 11
f=0.1; 0.5
0.5 0.5
0.5
w1=cos(2*pi*f*t); 00 00
w2=square(2*pi*f*t); -0.5
-0.5 -0.5
-0.5
t1=0:5:9; -1 -1
-10 -10
f=0.1; 0 50
50 100
100 0 50
50 100
100
w3=cos(2*pi*f*t1); 11 11
w4=square(2*pi*f*t1); 0.5
0.5 0.5
0.5
subplot(2,2,1) 00 00
stem(w1) -0.5 -0.5
-0.5 -0.5
subplot(2,2,2)
-1 -1
stem(w2) -11
1 1.5
1.5 22 -11
1 1.5
1.5 22
subplot(2,2,3)
stem(w3)
subplot(2,2,4)
stem(w4)
0.6
0.6
Code 2: 0.4
0.4
0.2
clc,clear,close 0.2
t=0:4:9; 00
f=0.1; -0.2
-0.2
w1=sin(2*pi*f*t); -0.4
-0.4
stem(w1) -0.6
-0.6
-0.8
-0.8
-1
-11
1 1.2
1.2 1.4
1.4 1.6
1.6 1.8
1.8 22 2.2
2.2 2.4
2.4 2.6
2.6 2.8
2.8 33