Laboratory Activity 2
Laboratory Activity 2
% Laboratory Activity 2
t = 0:1:36;
x = zeros(1,37);
x(1,19) = 1;
stem(t,x);
II.A
clc;
close all;
clear all;
t = -1:0.0001:1;
y = sin(2*pi*2*t);
plot(t,y,'b','linewidth',1);
ylabel("Amplitude");
xlabel("Time(t)");
II.B Sample the function x in Part II at 12 Hz frequency. (In sampling, set the resolution of time(t) to the
period of the sampling frequency.) Use blank line and the circle marker in the plot to distinguish
sampling points. (See “LineSpec”of the plot function)
subplot(3,1,3);
ys = sin(2*pi*12*ts/6);
stem(ts,ys,'k','linewidth',2);
hold off;
a. There are 24 samples in the interval [-1:1]
b. The plot in part II changes in the plot in part III due to sampling. The original input analog
signal has a frequency of 2 Hz, then it is multiplied to a railing function which has a frequency
of 12Hz. The product of the input analog signal and the railing function is the sample signal
which is the plot in part III.
c. If the frequency increase then the number of samples will decrease, consequently it will
decrease once the frequency decreases.
III. Use “sound” function of MATLAB to hear the sound of the function x(t) = sin(2π(2t)) at -100≤t≤100.
(see help sound).
a. Try the sample frequencies of 2kHz, 10kHz, 20kHz and 50kHz. Generalize your observation on
the sample frequency, tone and duration of the sound produced.
b. Try to multiply the sampled signal (x) to 0.5, 2, and 3 at 10kHz sampling frequency. (example:
sound (2*x, 10000)). Generalize your observation.
Answers