Sunteți pe pagina 1din 5

Sri Lanka Institute of Information Technology

BSc (Hons) in Engineering (EEE/CSE/EPE)


EC 247 Computing for Engineers
Laboratory 3 Plotting, Analyzing Waveforms & Audio Signals
Note:
Copy the given folder to a convenient location. Change your Matlab working directory to the folder
that you copied. Proceed with your work and save any m-files in the same folder.
Part I - Plotting
1. Plot a parabolic curve using the syntax given below

2. Replace the last line with the syntax below and observe the output for each case:
(a)
(b)
(c)

3. Save the data generated (x & y) in to an excel file as shown below:

4. Why is it necessary to use C = [x y] instead of C = [x y]?

Part II Waveform Analysis


In this section you are expected to empirically observe how the sampling frequency affects a
waveform that is being observed at regular time intervals Ts, for given time period.
2.1. A simple Sine wave
1. Copy the code given below:
2. Change the value of fs accordingly and observe the outputs in each case given:
(a). fs = 100
(b). fs = 50
(c). fs = 20
2.1. Generating different frequencies
1. You will be generating a sinusoidal wave with the following characteristics:

Period of observation

0.05 s

Sampling frequency

fs : 8000

Frequency of the signal

f0 : 523.23 Hz

Hz

The sine wave will be observed ever Ts (1/fs) seconds which we define as:

The output could be defined by:

You may observe the output in the form of:


(a) An audio file or sound

The generated signal is saved in to a file as you may see this appear in your folder. The
function sound allows you to hear what you have saved.

(b) A plot (Observe the differences between the two subplots.)

2. Copy the code you used above and similarly, generate a new waveform wave1 which
would have the following characteristics (use the same m-file).

Period of observation

0.05 s

Sampling frequency

fs1 : 800

Frequency of the signal

f0 : 523.23 Hz

Time (t) - t1

Hz

= 0 : 1/(fs1/100) : end_time ;

(a) With reference to part 2.1 sections (a) notice the difference in sound as fs decreases.
(b) Plot the new wave generated in subplots (3,2,3) and (3,2,4) and observe the output.

(You may use the same method as in 2.1 (b)

Note: when plotting ensure that you use the new time array t1 and new waveform wave1.

3. Repeat the above procedure to generate a new waveform wave2 which would have the
following characteristics (use the same m-file).

Period of observation

0.05 s

Sampling frequency

fs2 : 80

Frequency of the signal

f0 : 523.23 Hz

Time (t) - t2

Hz

= 0 : 1/(fs2/100) : end_time ;

(c) With reference to part 2.1 sections (a) notice the difference in sound as fs decreases.
(d) Plot the new wave generated in subplots (3, 2, 5) and (3, 2, 6) and observe the output.

Part III Audio Files (Further work - Homework)


1. You have been given an audio file named audio_file , load that file in to Matlab as shown
below:

2. Listen to the audio file.

3. Plot the waveform [Make plot and stem subplots respectively in (2,2,1) and stem in (2,2,2)].
Observe the output.

4. Reverse the audio file using the command flipud

5. Subplot in (2,2,3) and (2,3,4) the waveforms of the reversed audio signal. Observe the
output.

6. Now, listen to the reversed audio signal and verify your observation from part 5. (Use your
knowledge from Part III section 3)

S-ar putea să vă placă și