0% found this document useful (0 votes)
37 views3 pages

Laboratory Activity 2

This document discusses signals and sampling in a laboratory activity. Part I introduces the activity. Part II analyzes a sine wave with a frequency of 2 Hz and period of 0.5 seconds. It is sampled at 12 Hz in Part III, resulting in 24 samples over the interval. Increasing the sampling frequency would yield more samples while decreasing it would yield fewer. Part III uses the MATLAB sound function to play the sine wave at different sampling frequencies. Higher frequencies produce faster beats and shorter sounds, while lower frequencies have slower beats and longer durations. Multiplying the sampled signal changes its amplitude or volume.

Uploaded by

Rey nava
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)
37 views3 pages

Laboratory Activity 2

This document discusses signals and sampling in a laboratory activity. Part I introduces the activity. Part II analyzes a sine wave with a frequency of 2 Hz and period of 0.5 seconds. It is sampled at 12 Hz in Part III, resulting in 24 samples over the interval. Increasing the sampling frequency would yield more samples while decreasing it would yield fewer. Part III uses the MATLAB sound function to play the sine wave at different sampling frequencies. Higher frequencies produce faster beats and shorter sounds, while lower frequencies have slower beats and longer durations. Multiplying the sampled signal changes its amplitude or volume.

Uploaded by

Rey nava
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/ 3

Signals - Laboratory Activity 2

Rey Mark Nava


Ezekiel Anthony Jacobo
Gerald Ken Galvez
I.

% 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)");

a. What is the frequency of this


sine wave in hertz and in radian
per seconds? Explain why.
- 2Hz or 4π rad/s(1Hz=2π). The sine wave has completed two cycles in 1 second.
b. What is the period in seconds? Explain why.
𝟏 𝟏
- T = 𝒇 , where f = 2Hz, so 𝟐
or 0.5 seconds. It means that the wave has completed one cycle
in 0.5 seconds.
c. How many complete cycles are there in [-1:1]?
- If [-1,1] = 2s and f = 2Hz, then 2s(2Hz) = 4Hz, therefore there are 4 complete cycles in [-
1:1].

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)

a. How many samples are there in the interval [-1:1]?


b. Explain why the plot in part II changes in to plot in part III after sampling.
c. What will happen if you increase the sampling frequency? If you decrease the sampling
frequency?
clc;
close all;
clear all;

%Setting Sapmle Time(t and ts)


with the sampling frequency
f=12Hz
t = -1:0.01:1;
ts = -1:1/12:1;

%Graphing Orginal Analog


Signal
y = sin(2*pi*2*t);
subplot(3,1,1);
plot(t,y,'b','linewidth',2);
ylabel("Amplitude");
xlabel("Time(t)");

%Graph of Sampled input analog


signal
ys = sin(2*pi*12*ts/6);
subplot(3,1,2);
stem(ts,ys,'k','linewidth',2);
ylabel("Amplitude");
xlabel("Time(t)");

%Plotting the Input analog


signal VS the sampled digital
signal in the same graph
subplot(3,1,3);
plot(t,y,'b','linewidth',2);
ylabel("Amplitude");
xlabel("Time(t)");
hold on;

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

clc; a. The higher the sampling frequency (fs) it gets the


close all; slower the beat the sound generates. Meaning at fs =
clear all; 2kHz the sound beats faster and the shorter the sound
fs=2000;%sampling frequency
t=-100:1/fs:100; duration, on the other hand at fs = 50kHz the sound beats
x=sin(2*pi*2*t); much slower and it has longer duration.
sound(x);

clc; b. Multiplying the sampled signal (x) is basically


close all; multiplying its volume(amplitude), meaning if you
clear all; multiply it by 0.5 the sampled signal sound
fs=2000;%sampling frequency
t=-100:1/fs:100; volume(amplitude) will be reduced by half hence it will
x=sin(2*pi*2*t); increase its volume if you multiply it by 2x 3x. The
sound(2*x, 10000); sampling frequency sets the tempo of the sound signal,
which is in the example “sound(2*x, 10000) ”it is set
to 10kHz.

You might also like