Signals Proj 170630
Signals Proj 170630
STUDENT NAME:
MOHAMMAD UMAIR
SESSION:
FALL 2019
16/12/19
1
Table of Contents
1. Objective ................................................................................................................... 3
2. Introduction ............................................................................................................... 3
3.Code ............................................................................................................................. 3
4.Results ......................................................................................................................... 6
5.Conclusion ................................................................................................................... 9
2
PROJECT REPORT
1. Objective:
2. Introduction:
In this report, we will cover the MATLAB code to perform different functions we’ve learnt
in the signals and systems class and observe their properties.
3. Code:
clc
close all
clear all
tic
%Signal_Project_170630
%Sound Recorder (for x(t)):
recObj = audiorecorder(16000,8,1); %create object for recorder and
set its bitrate etc
disp('Start speaking.');
recordblocking(recObj, 10); %set the record time
disp('End of Recording.');
play(recObj);
x = getaudiodata(recObj);
figure(1)
plot(x); %plot the voice signal
title('Voice Signal x(t)')
%Functions and their impulse response h(t):
%Domain
t=(-pi:0.01:pi); %set the domain for the
functions
%sine:
figure(2) %used to display more than one
figures at once
A=sin(t);
3
h1=impulse(A,t); %h1 as impulse for sin
subplot(3,2,1); %plots multipe figures in one
plot(h1);
title('imp for sin(x)')
%cosine
B=cos(t);
h2=impulse(B,t); %h2 as impulse for cos
subplot(3,2,2);
plot(h2);
title('imp for cos(x)')
%exponential
C=exp(t);
h3=impulse(C,t); %h3 as impulse for exp
subplot(3,2,3);
plot(h3);
title('imp for exp(x)')
%ramp
unitstep= t>=0;
ramp=t.*unitstep;
D=ramp;
h4=impulse(D,t); %h4 as impulse for ramp
subplot(3,2,4);
plot(h4);
title('imp for ramp(x)')
%tan
E=tan(t);
h5=impulse(E,t); %h5 as impulse for tan
subplot(3,2,5);
plot(h5);
title('imp for tan(x)')
%Convolution y(t)=x(t)*h(t):
figure(3)
y1=conv(x,h1); %convolution command
subplot(3,2,1);
plot(y1);
title('conv of voice with h1')
y2=conv(x,h2);
subplot(3,2,2);
plot(y2);
title('conv of voice with h2')
y3=conv(x,h3);
subplot(3,2,3);
plot(y3);
title('conv of voice with h3')
y4=conv(x,h4);
subplot(3,2,4);
plot(y4);
title('conv of voice with h4')
y5=conv(x,h5);
subplot(3,2,5);
plot(y5);
4
title('conv of voice with h5')
%Fourier Transform:
figure(4)
X=fft(x); %fourier transform command
plot(X);
title('F.T of voice')
H1=fft(h1);
subplot(3,2,2);
plot(H1);
title('F.T of h1')
H2=fft(h2);
subplot(3,2,3);
plot(H2);
title('F.T of h2')
H3=fft(h3);
subplot(3,2,4);
plot(H3);
title('F.T of h3')
H4=fft(h4);
subplot(3,2,5);
plot(H4);
title('F.T of h4')
H5=fft(h5);
subplot(3,2,6);
plot(H5);
title('F.T of h5')
5
yt4=conv(Xift,H4ift);
subplot(3,2,4);
plot(yt4)
title('Conv after F.t and I F.t')
yt5=conv(Xift,H5ift);
subplot(3,2,5);
plot(yt5)
title('Conv after F.t and I F.t')
toc
4. Results:
6
Fig 1.3: Convolution y(t)=x(t)*h(t)
7
Fig 1.5: Convolution after Inv Transform
5. Conclusion:
In in this lab, we used different MATLAB tools and commands to prove different
properties of signals and observed their graphs . We also proved that inverse fourier has the same
result as before fourier took place i.e. it has the inverse effect of fourier transform.