0% found this document useful (0 votes)
33 views

Sns Lab 7 19-Ee-0

The document is a lab report submitted by Muhammad Uzair Shafique (Roll number: 19-EE-18) to Engr. Hammad Haider in the Department of Electrical Engineering & Technology, Taxila. The lab report describes tasks completed in the Signals & Systems lab including listening to synthesized signals at different sampling frequencies, importing and plotting an audio file, applying effects like amplification and echo to audio signals, and displaying a random integer matrix as a color image.

Uploaded by

Ghufran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Sns Lab 7 19-Ee-0

The document is a lab report submitted by Muhammad Uzair Shafique (Roll number: 19-EE-18) to Engr. Hammad Haider in the Department of Electrical Engineering & Technology, Taxila. The lab report describes tasks completed in the Signals & Systems lab including listening to synthesized signals at different sampling frequencies, importing and plotting an audio file, applying effects like amplification and echo to audio signals, and displaying a random integer matrix as a color image.

Uploaded by

Ghufran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

LAB REPORT 7

Signals & Systems (S&S)


(LAB)

SUBMITED TO
Engr. Hammad Haider

SUBMITED BY
Muhammad Uzair Shafique

Roll number: 19-EE-18


Section: B

DEPARTMENT OF ELECTRICAL ENGINEERING &


TECHNOLOGY, TAXILA
Date: 27-7-2021
LAB TASK 1:

(I) If >>x=cos(2*pi*2000*t)+1/2*sin(2*pi*4000*(t-pi/4))
+1/4*cos(2*pi*8000*t);
Take time t = 0: 1/Fs: 1-1/Fs; where Fs = 44.1kHz.
a) Listen to this signal using audioplayer (built in func. in
MATLAB)

MATLAB CODE:
%uzair Shafique
%19-EE-18
clc;
clear all;
%%Time specifications:
Fs = 44100; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:1-dt)'; % seconds

% hertz
x1=cos(2*pi*2000*t);
x2=1/2*sin(2*pi*4000*(t-pi/4));
x3=1/4*cos(2*pi*8000*t);
x=x1+x2+x3;

p=audioplayer(x,Fs);
play(p);

plot(t,x);
xlabel('time (in seconds)');
zoom xon;

OUTPUT:

19-EE-18
b) Now use resample func. to implement x with Fs = 48kHz. Listen to
this again and compare it with previous. Also use subplot to plot both
signals. Give comments about their comparison.

MATLAB CODE:
%uzair Shafique
%19-EE-18
clc;
clear all;
%%Time specifications:
Fs = 44100; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:1-dt)'; % seconds
% hertz
x1=cos(2*pi*2000*t);
x2=1/2*sin(2*pi*4000*(t-pi/4));
x3=1/4*cos(2*pi*8000*t);
x=x1+x2+x3;

p=audioplayer(x,Fs);
play(p);

%%Time specifications:
Fs1 = 48000; % samples per second
dt = 1/Fs1; % seconds per sample
StopTime = 0.25; % seconds
t1 = (0:dt:1-dt)'; % seconds

% hertz
x11=cos(2*pi*2000*t1);
x22=1/2*sin(2*pi*4000*(t1-pi/4));
x33=1/4*cos(2*pi*8000*t1);
y=x11+x22+x33;
p=audioplayer(y,Fs1);
play(p);
% Plot the signal versus time:
figure;
subplot(2,1,1);
plot(t,x);
subplot(2,1,2);
plot(t1,y);
xlabel('time (in seconds)');
zoom xon;

OUTPUT:

19-EE-18

CAMPARISON OF Fs=44.1kHz & Fs=48kHz:


 44.1k have sinusoidal peak white 48k have straight peak
I. >> [x,Fs]=audioread(‘filename’) used to import an audio file to
MATLAB. Use this along with audioplayer to play audio file. Determine
its size, plot it and observe its response.

MATLAB CODE:
clc;
clear all;
[x,Fs]=audioread('myrecording.M4A') ;
p=audioplayer(x,Fs);
play(p);
plot(x);

SIZE AND RESPONSE:

OUTPUT:
19-EE-18
Lab Task 2:
(i) Now listen to signal audioplayer(0.5*x, Fs) & audioplayer(2*x, Fs) in task 1(ii).
Again listen to same signal but with audioplayer(x, 2*Fs) & audioplayer(x, 0.5*Fs)
Comment on the different voices listen till now including this and last task 1(ii)

WITH (0.5*x,Fs)
MATLAB CODE:
%uzair Shafique
%19-EE-18
[x,Fs]=audioread('myrecording.M4A');
p=audioplayer(0.5*x,Fs);
play(p);
plot(x);
suptitle('19-EE-18');
OUTPUT:
19-EE-18

WITH (2*x,Fs)

MATLAB CODE:
%uzair Shafique
%19-EE-18
[x,Fs]=audioread('myrecording.M4A');
p=audioplayer(2*x,Fs);
play(p);
plot(x);
suptitle('19-EE-18');

OUTPUT:

19-EE-18
WITH (x,0.5*Fs)

MATLAB CODE:
%uzair Shafique
%19-EE-18
[x,Fs]=audioread('myrecording.M4A') ;
p=audioplayer(x,0.5*Fs);
play(p);
plot(x)
suptitle('19-EE-18');

OUTPUT:

19-EE-18
WITH (x,2*Fs)

MATLAB CODE:
%uzair Shafique
%19-EE-18
[x,Fs]=audioread('myrecording.M4A') ;
p=audioplayer(x,2*Fs);
play(p);
plot(x)
suptitle('19-EE-18');

OUTPUT:

19-EE-18
COMMENT
%When we develop 0.5*x, it speed down the signal.
%When we develop 2*x, it speed up the signal
%When we develop 0.5*Fs, frequency become low , voice become grind and time
duration also reduced
%When we develop 0.5*Fs, frequency become high, voice become shrill and time
duration also reduced

ii) Apply time shifting property to the audio signal imported in task 1
part (ii) to apply an “echo” as given in manual. Listen it to observe echo.
Scale both signal(x) and Fs to this echo signal as above in task 2 part i
and see the difference b/w these two. Comment on it.

MATLAB CODE:
%uzair Shafique
%19-EE-18
[x,Fs]=audioread('myrecording.M4A') ;
delay=0.5;
alpha=0.7;
D=delay*Fs;
y=zeros(size(x));
y(1:D)=x(1:D);
for n=D+1:length(x);
y(n)=x(n)+alpha*x(n-D); %Y[n] = x[n] + a* x[n-d] where d is delay in
time
end
q=audioplayer(y,Fs);
play(q);
subplot(2,1,1);
plot(x);
subplot(2,1,2);
plot(y);
xlabel('time (in seconds)');
zoom xon;

OUTPUT:
19-EE-18

LAB TASK 3:
i) creates a 5X5 matrix of random integers in the range from 1 to the
number of colors(take different values of r from 1 to 64 to see colors)
and display it by using image command
MATLAB CODE:
%uzair Shafique
%19-EE-18
clc;
clear all
C = [0 2 4 6 8;10 12 14 16 18;20 22 24 26 28;30 32 34 36 38;40 42 44 46 48];
image(C);

OUTPUT:
19-EE-18

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy