You are on page 1of 2

COURSE/SECTION: ECE011/EC22FB1

NAME: Deocadiz, Angelito B.


STUDENT NO: 1810910
ACTIVITY: Assignment
SCORE
DATE: 11/28/2019
PERIOD: Prelims/Midterms/Finals

Using matlab or octave. Do the following exercises. Provide screenshots of your codes and
resulting figures. Submit your assignment in class.
Objectives:
1. Plot signals in time and frequency domains.
2. Analyze signals using fast Fourier transform (fft).

Problem: Determine the frequencies in a given audio file.

Procedure:
1. Load the audio file mixSinusoid.wav which is composed of three pure-tone signals with some
noise. (note: the wav file must be in same folder directory for matlab to locate the file)

Fs = sampling frequency
clc; clear;
%========Loading audio file
[x,Fs]=wavread('mixSinusoid.wav'); %Loading the wav file
Question
1: For what is variable ‘x’? What is the sampling frequency Fs?
Hint: in the command window just type ‘x’

2. Plotting the file in time domain


%========Plotting in Time Domain
subplot(2,1,1);
plot(x);
xlabel('Time'); title('Audio Signal in Time Domain'); grid on
Question
2: In the command subplot, what are these values represent?

3. Plotting the signal in Frequency Domain using fft


%========Plotting in Frequency Domain Using fft
fn=Fs/2; %calculates the Nyquist sampling rate
L = 1000; %fft 1000 point of the signal
X=fft(x,L); %fft
magX=abs(X);
magX=magX(1:L/2);
f = fn*[0:(L/2-1)]/(L/2); %transforms the frequency axis to Hz
subplot(2,1,2);
plot(f,magX);
xlabel('Freq (Hz)'); title('Freq. response of a the three tones'); grid on

Question 3: What is fft? What are the three tones in the audio file?
Hint: Use ‘data cursor button’ in the matlab
figure windown to know the data points.

Question 4: Why do we transform signals in


frequency domain?

Note: Screenshots your resulting figures


COURSE/SECTION: ECE011/EC22FB1
NAME: Deocadiz, Angelito B.
STUDENT NO: 1810910
ACTIVITY: Assignment
SCORE
DATE: 11/28/2019
PERIOD: Prelims/Midterms/Finals
1. The variable x is the relative amplitude of the audio data. By typing x in the command
window, it shows the individual values at different times of the amplitude of the audio data.
The sampling frequency is the number of times per second that the amplitude of the signal
is measured. In this audio, the sampling frequency is 16kHz.
2. The values inside the subplot represents the number of rows, column, and the location of
the resulting graph. For instance, having a value of 2 1 1 in the provided code means that
it will create an interface that will have two rows, one column, and a graph that is located
on the first row and first column of the created graphical interface. Another example
would be, having a value of 3 2 2 means that it will create an interface that will have three
rows, two columns, and a graph that is located on the first row and second column of the
interface.
3. FFT or Fast Fourier Transform is an algorithm which can be used in different types of signal
processing. It takes the signal (in this activity the audio) and converts the domain of the
signal (time domain) to a representation in the frequency domain. The three tones in the
audio file are the signals that are separated from the noise in the audio which has an
amplitude of 107, 91.61, and 95.36 which has a frequency of 256, 432, and 800 respectively.
4. We transform signals in frequency domain because this makes adjustments of some
parameters in the signal be carried out easily, the reason is that the noise created in the
system and variation of some parameters can be easily be distinguished using this.
Functions which are really complicated to determine its behavior to analyze its parameters
can be easily done by transforming signals in frequency domain.

Screenshots of the codes and resulting figures

Figure 2 Resulting graph


Figure 1 MATLAB code

You might also like