Jke eBook Signal and System
Jke eBook Signal and System
Writer
Fauziah Binti Aliman
Syamsul Bahri Mohamad
Published in 2022
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any
form or by any means, including photocopying, recording, or other electronic or mechanic methods,
without the prior written permission of the writer, except in the case of brief quotations embodied
in reviews and certain other non-commercial uses.
Fauziah Aliman
SIGNAL AND SYSTEM: WITH GNU OCTAVE SIMULATION / FAUZIAH BINTI
ALIMAN, SYAMSUL BAHRI MOHAMAD.
Mode of Access: Internet
eISBN 978-967-2762-14-0
1. Signal processing.
2. Signal theory (Telecommunication).
3. System analysis.
4. Government publications--Malaysia.
5. Electronic books.
I. Syamsul Bahri Mohamad.
II. Title.
621.3822
Published by:
Politeknik Merlimau, Melaka
KB1031 Pej Pos Merlimau,
77300 Merlimau Melaka
3
EDITORIAL BOARD
MANAGING EDITOR
Ts. Dr Maria binti Mohamad
Sr. Firhan bin Salian
Ts. Rodzah binti Hj Yahya
Aylin binti Kamaruddin
Hafidah binti Mahat
Noraini binti Ya'cob
EDITOR
Shaidzwan Bin A.Rahim
Ketua Program
Diploma Kejuruteraan Elektronik (Komunikasi)
DESIGNER
Fauziah Binti Aliman
Syamsul Bahri Mohamad
4
Acknowledgement
In the name of Allah, the Most Gracious and the Most Merciful.
My humblest gratitude to the Holy Prophet Muhammad (Peace be upon him) whose
way of life has been continuous guidance for us. Thank you to everyone who has been
supporting us in preparing this e-book. Never stop learning !
52
Preface
This book is suitable for one semester course. The author has taught the
subject material at Polytechnic Merlimau in Melaka, Malaysia, for many
years and has covered all of the contents in 14 weeks, with two lecture
hours weekly. GNU Octave is open- source software that can be freely
distributed. Students may redistribute and/or modifyit under the
provisions of the Free Software Foundation's GNU General Public License
(GPL).
2
Table of Contents
01 Signals and Systems Page 1
02 Page 15
Linear Time-invariant Systems
Signals and
Systems
Signals and systems theory and idea are Time is considered as a discrete variable
required in practically all electrical in discrete time, which regards values of
engineering specialties, as well as many variables as occurring at distinct, separate
other technical and scientific disciplines. "points in time," or equivalently as
The mathematical description and remaining unchanging across each non-
representation of signals and systems, as zero region of time.
well as their classifications, are covered in
this chapter along with a few key As time passes from one time period to
fundamental signals that are critical to the the next, a non-time variable jumps from
studies. one value to the next. This perception of
time is analogous to a digital clock that
Discrete time and continuous time are displays a fixed reading, for example, of
two different frameworks for modelling 10:37 for a period of time before jumping
variables that change over time in to a new fixed reading of 10:38, and so
mathematical dynamics. on. In most cases, measurements are
taken at sequential integer values of the
variable time.
Source: pixabay
SIG N AL A N D SYST EM W IT H G N U O C T A VE
1
SIMU L A T IO N
Chapter 1 : Signals and Systems
Classification of Signal
A signal is a function that represents a In short, a signal x(t) is a continuous-time
physical quantity or variable and usually signal if t is a continuous variable.
incorporates information about the
phenomenon's behavior or nature. In an
resistor-capacitor (RC) circuit, the signal
could represent the voltage across the
capacitor or the current flowing through
the resistor, for example. A signal is
mathematically expressed as a function of
the independent variable t. t usually
stands for time. Thus, a signal is denoted
Fig. 1.1: Graphical representation of continuous-
by x(t).
time signal
Continuous-time Signal
2
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
Source: pixabay
SIG N AL A N D SYST EM W IT H G N U O C T A VE 3
SIMU L A T IO N
Chapter 1 : Signals and Systems
Discrete-time Signal
SIG N AL A N D SYST EM W IT H G N U O C T A VE 4
SIMU L A T IO N
Chapter 1 : Signals and Systems
Source: pixabay
5
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
C. Sinusoidal Sequence
6
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
Source: pixabay
Simulation
Students can learn how to utilize the Basic Continuous-time Signal
octave-online software in order to create
numerous waveforms that are commonly A. Unit Step Function
used for continuous time signal
processing and discrete time signal The unit steps are already incorporated
processing. GNU Octave, an open-source into GNU Octave. The names of the
alternative to MATLAB, has a web mathematicians who utilized them in
interface called Octave Online. their work are used to identify them.
Heaviside(t) is the name of the unit step
function. The example below shows how
they can be used.
t=-20:0.001:20
y=heaviside(t) % Create unit step function
plot(t,y) % Plot unit step function
axis([-10 10 -2 2]) % Define axis margin
7
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave displays the unit step function waveform as shown in Fig. 1.13 where it
satisfies the definition of unit step function as
Similarly , the unit impulse function waveform is illustrated using the below example :
8
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave display unit impulse function waveform as shown in Fig. 1.14 where it
satisfies the definition of unit impulse function as
C. Sinusoidal Signals
The continuous-time sinusoidal waveform signals are illustrated using the following array
commands
9
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave displays continuous-time sinusoidal signal waveform as shown in Fig. 1.15.
The unit step sequence waveform signals are illustrated using the following array
commands
10
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave displays the unit step sequence waveform as shown in Fig. 1.16 where it
satisfies the definition of unit step sequence as
Similarly , the unit impulse sequence waveform is illustrated using below example :
11
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave displays the unit impulse sequence waveform as shown in Fig. 1.17 where it
satisfies the definition of unit impulse sequence as
C. Sinusoidal Sequence
The discrete-time sinusoidal waveform is illustrated using the following array commands
12
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
GNU Octave displays the discrete-time sinusoidal waveform as shown in Fig. 1.18.
13
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 1 : Signals and Systems
Source: pixabay
Exercises
1. Write the discrete-time cosine array commands . Use subplot (2,1,2). Label for each axis
and name the title of the graph.
2. Write the array commands for Impulse Shifted Function when δ (n- 2). Label for each
axis and name the title of the graph.
3. Write the waveform command for Step Shifted Function when u (n + 2). Label for each
axis and name the title of the graph.
14
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
Linear Time-invariant
(LTI) Systems
Linearity and time-invariance are two of The significance of the convolution
the most significant characteristics of operation in LTI systems arises from the
systems. The fundamental input-output fact that understanding an LTI system's
relationship for systems with these reaction to the unit impulse input helps
features is developed in this chapter. The us to identify its output to any input
input-output relationship for LTI systems signals.
will be shown as to be defined by a
convolution operation.
Source: pixabay
15
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
16
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
For t < 0
y(t) = 0 y(t) = 0
Thus, we obtain
0,
𝑡<0
𝑡, 0<𝑡≤2
𝑓 𝑥 = 2, 2<𝑡 ≤3
t 5 − 𝑡, 3<𝑡≤5
y(t) = 0 dτ = t
0, 5<𝑡
For 2 < t < 3
t
y(t) = t−2 dτ = 2
3
y(t) = t−2 dτ = 5 - t
17
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
y[n] = x[n]*h[n]= σ∞
𝑘=−∞ ℎ 𝑘 𝑥[𝑛 − 𝑘]
Example:
18
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
y[0] = 1 y[4] = 1 + 1 = 2
For n = 1 For n = 5
y[1] = 1 + 1 = 2 y[5] = 1
y[2] = 1 + 1 + 1 = 3 y[>5] = 0
For n = 3
y[3] = 1 + 1 + 1 = 3
19
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
20
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
Simulation
Students can learn how to utilize octave-online software to write and execute convolution
integral signals problem as well as convolution sum signals problem.
We are utilizing the heaviside(t) command in GNU Octave to perform convolution integral
simulation. To simulate y(t) = x(t) * h(t), two unit step function are used as shown in Fig. 2.3.
The example of command array given shows how the convolution integral is done .
% set x(t)
t=-5:0.01:5;
x=heaviside(t)-heaviside(t-1);
subplot(3,1,1);
plot (t,x);
axis([-2 5 -1 1.5]);
xlabel('t'); ylabel('x(t)=u(t)-u(t-1)');
title({'Convolution integral y(t)=x(t)*h(t)'})
% set h(t)
h=heaviside(t)- heaviside(t-4);
subplot(3,1,2);
plot (t,h);
axis([-2 5 -1 1.5]);
xlabel('t'); ylabel('h(t)=u(t)-u(t-4)');
% perform convolution of x(t)*h(t)
m=conv(x,h); subplot(3,1,3); plot (m);
axis([0 2000 -100 150]); xlabel('t'); ylabel('y(t)');
21
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
GNU Octave displays the continuous-time input x(t), impulse response h(t) and
convolution output y(t) as shown in Fig. 2.4.
22
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
Convolution Sum
The convolution operation in GNU Octave is performed by using conv command. Similar
to convolution integral, convolution sum is perform on the input x[n] and impulse
response h[n]. The output is denoted by y[n]. The simulation on convolution sum of x[n]
and h[n] can be achieved by using the following command array example. Note that the
bold sequence is referring to n=0.
1 2 4 5
x[n] = ൜0, , , 1, , , 2ቅ
3 3 3 3
h[n] = {1, 1, 1 ,1 , 1}
clear all
%input signal
n=0:6;
xn=0:1/3:2;
figure, stem(n,xn)
grid
xlabel('n’)
ylabel('x[n]’)
title('Input signal')
%impulse response
h1=-2;xh1=1;
h2=-1;xh2=1;
h3=0;xh3=1;
h4=1;xh4=1;
h5=2;xh5=1;
h=[h1,h2,h3,h4,h5];
hn=[xh1,xh2,xh3,xh4,xh5];
figure, stem(h,hn)
grid
xlabel('n’)
ylabel('h[n]’)
title('Impulse Response')
23
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
%output signal
yn=-2:8;
y=conv(hn,xn);
figure, stem(yn,y)
grid
xlabel('n')
ylabel('y[n]')
title('Output 1 of Convolution Sum')
GNU Octave displays the discrete-time input x[n], impulse response h[n] and convolution
output y[n] as shown in Fig. 2.5 to Fig. 2.7.
24
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
25
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 2 : Linear Time-invariant (LTI) Systems
Source: pixabay
Exercises
1. Display the output graph of y(t) = x(t)*h(t) using convolution integral where
x(t) = 3u(t) – 3u(t - 1) and h(t) = 2u(t) – 3u(t - 4) . Write and execute the command.
Choose a suitable axis for all graphs x(t), h(t) and y(t).
2. Write and compute the output of LTI systems for the following signal below for
y[n]=x[n]*h[n] using octave online. Use the function conv or [y=conv(h,x)] to compute
the problem in convolution sum.
x[n] = {1,-1,2,-1,1}
h[n] = {1,1,1,1}
26
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
Source: pixabay
27
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
The Laplace transform, named after its Oliver Heaviside, an English electrical
inventor Pierre-Simon Laplace, is an integral engineer, suggested a comparable
transform in mathematics. It converts a technique without employing the
real-valued function t (typically time) into a Laplace transform and this results in an
complex-valued function s (complex operational calculus is known as the
frequency). Heaviside calculus.
28
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
Therefore, 1
b) X(s) = , Re{s} < -1
𝑠+1
1 1
X(s) = - -a< Re{s} < a 1
𝑠+𝑎 𝑠−𝑎 c) X(s) = 2
𝑠 +4
(s−a) –(s+a) 1 1 2
= d) X(s) = - -
(𝑠+𝑎)(𝑠−𝑎) 𝑠+2 𝑠+5 𝑠+5
−2a 6
= e) X(s) = 2
(𝑠+𝑎)(𝑠−𝑎) 𝑠 +36
Thus, Solution:
1
The pole-zero diagram and ROC : a) x(t) = L-1 = 𝒆−𝒕 𝒖 𝒕
𝑠+1
Im
1
b) x(t) = L-1 = -𝒆−𝒕 𝒖 −𝒕
𝑠+1
1
c) x(t) = L-1 2
𝑠 +4
Re {s}
1
-𝑎 𝑎 = L-1
𝑠 +22
2
= cos 2t u(t)
1 1 2
d) x(t) = L-1 - L-1 - L-1
𝑠+2 𝑠+5 𝑠+5
1 6
a) X(s) = , Re{s} > -1 = L-1
𝑠+1 𝑠 +62
2
= sin 6t u(t)
29
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
Simulation
GNU Octave is a high-level programming language that is mostly used for numerical
calculations. Octave is a numerical solver for linear and nonlinear problems, as well as a
language for executing various numerical experiments that is mainly compatible with
MATLAB. Other characteristics of this software are as follows:
• Free software that runs on GNU/Linux, macOS, BSD, and Microsoft Windows
with a powerful mathematics-oriented syntax and built-in 2D/3D charting and
visualisation features.
• Compatible with a wide range of Matlab scripts.
GNU Octave is used to compute Laplace transform using the laplace function. The following
example shows the program arrays. It is important for the user to download and install the
recent symbolic bundle package from https://github.com/cbm755/octsympy/releases
Laplace Transform
For each of the given continuous-time signal, Laplace transform are computed using the
following command array
Program : Output :
syms t s X = (sym)
x=4*sin(100*t)*heaviside(t)
X=laplace(x,t,s) 400
----------
s2 + 10000
30
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
Program : Output :
syms s t
laplace ((3*t^3)+(4*e^(5*t)))
GNU Octave can also compute the inverse Laplace Transforms using function ilaplace as
shown in the following example.
10(𝑠 + 1)
𝑋 𝑠 =
𝑠 2 + 4𝑠 + 3
Program : Output :
syms t s
x=10*(s+1)/(s^2+4*s+3)
ilaplace(x)
simplify(ans)
pretty(ans)
31
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
The graphical representation of X(s) through its poles and zeros in the s-plane is referred to
as the pole-zero plot of X(s). GNU Octave can compute the poles and zeros of any given
continuous-time function and map the pole-zero plot as illustrated in the following
example.
10(𝑠 + 1)
𝑋 𝑠 =
𝑠 2 + 4𝑠 + 3
Program :
num=[10 10]
den=[1 4 3]
sys=tf(num, den)
pzmap(sys)
p,z]=pzmap(sys)
The GNU Octave mapped the output as illustrated in Fig. 3.1 with zeros at s=0 and two poles
at s=-1 and s=-3
32
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
Source: pixabay
Exercises
1. Compute the Laplace transform of the following functions. Write the program in GNU
Octave using laplace command.
a) x(t) = e (-1/4) t
b) x(t) = 8 cos (10t) . 5u(2t)
c) x(t) = 2 cos 2t + 3 sin 2t
d) x(t) = e-t sin 5t + e-4t cos 3t
2. Using GNU Octave, compute the inverse Laplace Transforms of the following
functions.
10(s+1)
a) X s =
s2 +4s+8
6 2s 4
b) X s = + −
s s2 +16 s2
33
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 3 : Laplace Transform and Continuous -time LTI Systems
3. Using GNU Octave, compute the poles and zeros of the following function.
10(𝑠+1)
a) X 𝑠 =
𝑠 2 +4𝑠+8
2s+100
b) X s =
s+1 s+8 (s+10)
34
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Z-transform and
Discrete-time LTI
Systems
The Z-transform translates a discrete-time The inverse Z-transform is the reverse of
signal, which is a sequence of real or the Z-transform.
complex values, into a complex
frequency-domain representation in
mathematics and signal processing.
𝑋(𝑧) = 𝑥[𝑛]𝑧 −𝑛
𝑛=−∞
Source: pixabay
35
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Solution :
1 𝑧 1
( )𝑛 𝑢[𝑛 |z| > | |
1 2
2 𝑧−
2
1 𝑧 1
(− )𝑛 𝑢[𝑛] |z| > | |
1 3
3 𝑧+
3
1 𝑧 1
𝑍 {( )𝑛 𝑢[𝑛]} = 1 ; |z| > | |
2 𝑧−2 2
1 𝑧 1
𝑍{(− )𝑛 𝑢[𝑛]} = 1 ; |z| > | |
3 𝑧+3 3
Therefore,
𝑧 𝑧
𝑋(𝑧) = +
1 1
𝑧− 𝑧+
2 3
2 z ( z − 121 )
=
( z − 12 )( z + 13 )
36
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Simulation
WolframAlpha is a Wolfram Research computational knowledge engine and answer engine.
It directly responds to factual enquiries by computing the answer using data from external
sources.
The simulation for z-transform and inverse z-transform utilizes WolframAlpha online and
GNU Octave . The WolframAlpha computes z-transform . From the result, the GNU Octave is
used to compute the poles and zeros and map the pole and zeros plot.
Z-Transform
The WolframAlpha online widget for z-transform can be accessed online at the
WolframAlpha website as shown in Fig. 4.1.
1 1
x[n] = ( )𝑛 𝑢[𝑛] + ( )𝑛 𝑢[𝑛]
2 3
37
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Key in the given sequence in the widget by using the heaviside command as follows
(((1/2)^n)*heaviside(n)) + (((1/3)^n)*heaviside(n))
The GNU Octave code commands for the pole and zeros plot are as follows. Although there
are two poles dan two zeros for the X(z), note that due to the programming contains, user
can only plot one pole and zero at a time. The pole and zeros plot are shown in Fig. 4.3. User
may use the same code command to plot the other pole and zero.
Program :
38
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Inverse z-Transform
The WolframAlpha online widget for inverse z-transform can be accessed online at
WolframAlpha website as shown in Fig. 4.4.
39
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
10𝑧(𝑧+5)
X[𝑧] =
(𝑧−1)(𝑧−2)(𝑧+3)
(10z(z+5))/((z-1)(z-2)(z+3))
40
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 4 : Z-transform and Discrete-time LTI Systems
Source: pixabay
Exercises
1. Using WolframAlpha Online, compute the z-transform of the following functions.
Then compute the poles and zeros from the result using Octave Online. Write the
program.
1 1
a) x[n] = ( )𝑛 𝑢[𝑛] + ( )𝑛 𝑢[−𝑛 − 1]
3 2
1 1
b) x[n] = ( )𝑛 𝑢[𝑛] + ( )𝑛 𝑢[−𝑛 − 1]
2 3
4(2𝑧+1)
b) X[𝑧] =
(𝑧+1)(𝑧−3)
41
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous -time Signal and System
Fourier Analysis Of
Continuous-time Signal
and System
The Laplace transform and the z- Fourier analysis is necessary for
transform have been introduced in the describing certain types of systems and
previous chapters as to convert time- their attributes in the frequency domain,
domain signals into complex s-domain in addition to generating spectral
and z-domain. This representations are representations of signals. We will cover
more straightforward to examine and Fourier analysis in the context of
process for various reasons. These continuous-time signals and systems in
modifications also reveal more this chapter.
information about the nature and
behavior of various signals and systems.
Source: pixabay
42
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous -time Signal and System
43
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous -time Signal and System
44
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous -time Signal and System
Simulation
User can learn how to utilize octave-online software to execute Fourier Transform of
Continuous-Time and find the Fourier coefficient
We may utilize the heaviside(t) command in GNU Octave to plot a diagram of a periodic
continuous-time signal as shown in Fig. 9. The Fourier coefficient are found with the
following command array
𝑓(𝑡)
𝑡
0 1 2 3
%Diagram of continuous-time
ezplot(f,[0,2])
T=2
45
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous-time Signal and System
%Fourier coefficients
a1=2/T*int(f*cos(1*w0*t),t,0,T)
a2=2/T*int(f*cos(2*w0*t),t,0,T)
a3=2/T*int(f*cos(3*w0*t),t,0,T)
%Fourier coefficients
b1=2/T*int(f*sin(1*w0*t),t,0,T)
b2=2/T*int(f*sin(2*w0*t),t,0,T)
b3=2/T*int(f*sin(3*w0*t),t,0,T)
a1 a1 = (sym) 0
a2 a2 = (sym) 0
a3 a3 = (sym) 0
b1 = (sym)
2
b1
--
pi
b2 b2 = (sym) 0
b3 = (sym)
2
b3
----
3*pi
46
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 5 : Fourier Analysis Of Continuous -time Signal and System
Source: pixabay
Exercises
1. Execute the following integral function using GNU Octave as per example command
given.
47
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 6 : Fourier Analysis Of Discrete -time Signal and System
48
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 6 : Fourier Analysis Of Discrete -time Signal and System
Simulation
Fast Fourier Transform
User can learn how to utilize GNU Octave to simulate Fourier analysis on discrete-time
signal and system. The simulation is to covert a noise corrupted signal y(t) in time domain
into frequency domain . First, a sound signal is created as shown in Fig. 6.1. Then, a random
noise signal is created as shown in Fig. 6.2. This noise is added in the sound signal producing
a corrupted signal as shown in Fig. 6.3. Next, fast Fourier Transform (FFT) is performed on
the signal to calculate and plot the power spectrum as shown in Fig. 6.4. The number of
sampling points is at 1000Hz for 5 seconds. This simulation is done using the following
command array .
clc
clear all
% To convert a noise corrupted signal y in time domain into a frequency domain
% number of sampling points at 1000Hz for 5 seconds
t2=0:0.001:0.5;
x2 = sin(2*pi*50*t2) + sin(2*pi*120*t2); % a sound signal
figure(1)
plot(1000*t2(1:50),x2(1:50))
title('A sound signal x2');xlabel('Time(milliseconds)')
y = x2 + 2*randn(size(t2)); % create random noise to be added to the sound signal.
figure(2)
plot(1000*t2(1:50),y(1:50)) % plot the corrupted sound signal
title('Signal Corrupted with zero-mean Random noise');xlabel('time(milliseconds)')
% will perform 1 512-points fast Fourier transform(FFT), calculate and plot the
power spectrum
Y = fft(y,512);
Pyy = Y.*conj(Y)/512;
f = 1000*(0:256)/512;
figure(3)
plot(f,Pyy(1:257))
title('Frequency content of y');xlabel('frequency (Hz)')
49
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 6 : Fourier Analysis Of Discrete -time Signal and System
GNU Octave displays discrete-time input x[n], impulse response h[n] and convolution
output y[n] as shown in Fig. 6.1 to Fig. 6.4.
50
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 6 : Fourier Analysis Of Discrete -time Signal and System
51
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Chapter 6 : Fourier Analysis Of Discrete-time Signal and System
Source: pixabay
Exercises
Consider the periodic square wave x(t) shown in Fig. 6.5. Find the Fourier Series for the
function for which the graph is given below
Fig. 6.5
52
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
REFERENCES
Hwei P.Hsu. (2014). Schaums Outline of Digital Signal Processing (4th ed).,
United States: McGraw-Hill Education.
Steven T.Karris (2009). Digital Signal Processing Using MATLAB & Wavelets.
2nd Edition. Jones and Bartlett Publishers, Inc. Andreas Antoniou.
Sylvia Ong, Dyg Khayrunsalihaty. (2021). Signal and System : Augmented-
Reality Experience. Politeknik Kuching Sarawak.
Icon
www.pixabay.com
SIG N AL A N D SYST EM W IT H G N U O C T A VE
SIMU L A T IO N
Fauziah Aliman is the senior lecturer at Politeknik Merlimau,
Melaka (PMM). She earned a Bachelor's Degree in Electronic
Engineering at Multimedia University (MMU), Melaka and
Master's Degree in Electronic Engineering (System Electronics) at
Universiti Teknikal Malaysia Melaka (UTeM) . She is a registered
graduate engineer by Board of Engineers Malaysia. She has over
seven years of engineering experience in semiconductor industry.
In addition, she has over fourteen years of teaching experience
that she acquired at Technical and Vocational Education and
Training (TVET) institutions. She is currently with Department of
Electrical Engineering of Politeknik Merlimau.
671