Digital Signal Processing Using Matlab 1st Edition Andre Quinquis instant download
Digital Signal Processing Using Matlab 1st Edition Andre Quinquis instant download
https://ebookgate.com/product/digital-signal-processing-using-
matlab-1st-edition-andre-quinquis/
https://ebookgate.com/product/digital-signal-processing-using-
matlab-3rd-edition-vinay-k-ingle/
ebookgate.com
https://ebookgate.com/product/instructor-solution-manual-fundamentals-
of-digital-signal-processing-using-matlab-2nd-edition-robert-j-
schilling/
ebookgate.com
https://ebookgate.com/product/digital-image-processing-using-matlab-r-
rafael-c-gonzalez/
ebookgate.com
https://ebookgate.com/product/multirate-filtering-for-digital-signal-
processing-matlab-applications-1st-edition-ljiljana-milic/
ebookgate.com
Digital Signal Processing 1st Edition J.S. Chitode
https://ebookgate.com/product/digital-signal-processing-1st-edition-j-
s-chitode/
ebookgate.com
https://ebookgate.com/product/modern-digital-signal-processing-1st-
edition-roberto-cristi/
ebookgate.com
https://ebookgate.com/product/information-fusion-in-signal-and-image-
processing-digital-signal-and-image-processing-1st-edition-isabelle-
bloch/
ebookgate.com
https://ebookgate.com/product/digital-signal-and-image-processing-1st-
edition-tamal-bose/
ebookgate.com
This page intentionally left blank
Digital Signal Processing using MATLAB£
This page intentionally left blank
Digital Signal
Processing using
£
MATLAB
André Quinquis
First published in France in 2007 by Hermes Science/Lavoisier entitled “Le traitement du signal sous
Matlab£: pratique et applications”, 2nd edition
First published in Great Britain and the United States in 2008 by ISTE Ltd and John Wiley & Sons, Inc.
Apart from any fair dealing for the purposes of research or private study, or criticism or review, as
permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced,
stored or transmitted, in any form or by any means, with the prior permission in writing of the publishers,
or in the case of reprographic reproduction in accordance with the terms and licenses issued by the CLA.
Enquiries concerning reproduction outside these terms should be sent to the publishers at the
undermentioned address:
www.iste.co.uk www.wiley.com
The rights of André Quinquis to be identified as the author of this work have been asserted by him in
accordance with the Copyright, Designs and Patents Act 1988.
Quinquis, André.
[Traitement du signal sous MATLAB. English]
Digital signal processing using MATLAB / André Quinquis.
p. cm.
Includes bibliographical references and index.
ISBN 978-1-84821-011-0
1. Signal processing--Digital techniques. I. Title.
TK5102.9.Q853 2008
621.382'2--dc22
2007043209
Printed and bound in Great Britain by Antony Rowe Ltd, Chippenham, Wiltshire.
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1. Brief introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1. MATLAB software presentation . . . . . . . . . . . . . . . . . . . . 1
1.1.2. Important MATLAB commands and functions . . . . . . . . . . . . 3
1.1.3. Operating modes and programming with MATLAB . . . . . . . . . 8
1.1.4. Example of work session with MATLAB . . . . . . . . . . . . . . . 10
1.1.5. MATLAB language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2. Solved exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Preface
Sometimes it is easier to say what a book is not than what it exactly represents. It
may be also better to resume the authors’ motivations than to explain the book
content itself.
From this point of view, our book is certainly not a traditional course, although it
recalls many theoretical signal processing concepts. Indeed, we emphasize a limited
number of important ideas instead of making a detailed description of the involved
concepts. Intuitive manners have been used to link these concepts to physical
aspects. Hence, we hope that reading this book will be much more exciting than
studying a traditional signal processing course.
This book is also not a physics course, although a major purpose of most
proposed exercises is to link abstract signal processing concepts to real-life
problems. These connections are illustrated in a simple and comprehensive manner
through MATLAB£ simulations.
The main topics of this book cover the usual program of an undergraduate signal
processing course. It is especially written for language and computer science
students, but also for a much larger scientific community who may wish to have a
comprehensive signal processing overview. Students will certainly find here what
they are looking for, while others will probably find new and interesting knowledge.
This book is also intended to illustrate our pedagogical approach, which is based
on three major reasons:
1. Students need to know how the teaching provided can be useful for them; it is
their customer attitude.
x Digital Signal Processing using MATLAB
2. Students have good potential for doing independent work; their interest and
curiosity should be continuously stimulated by:
– using a diversified pedagogical approach that combines the two sides of a
complete presentation methodology: from components to the system and vice versa;
– encouraging them to take advantage of their creativity through interactive
educational tools; they should be allowed to make changes and even contribute to
their development.
3. Students have to improve and validate their knowledge through written work;
writing is still the best way to focus someone’s concentration.
The role of simulations is becoming more and more important in the framework
of a scientific education because it is an effective way to understand many physical
phenomena, some of them less known or mastered, and to take into account their
complexity. Simulations may be thus very useful for:
− understanding working principles and deriving behavior laws;
− learning about processing methods and systems running using algorithms to
reproduce them off-line;
− evaluating the performance and robustness of various algorithms and
estimating the influence of different parameters.
This book is based on a signal processing course, which has been successfully given
for many years in several universities. According to our experience, signal theory
abstract concepts and signal processing practical potentialities can be linked only through
tutorial classes and simulation projects. In this framework, simulations appear to be the
necessary complement for the classical tripod theory – modeling – experimentation.
This book brings together into a clear and concise presentation the main signal
processing methods and the related results, using MATLAB software as a simulation
tool. Why MATLAB? Because it is:
− simple to learn and to use;
− powerful and flexible;
− accurate, robust and fast;
− widespread in both academic and industrial environments;
− continuously updated by professionals.
Preface xi
The word “signal” stands for a physical entity, most often of an electrical nature,
like that observed at a microphone output. It is submitted to various transformations
when it goes through a system. Thus, in a communication chain, the signal is subject
to some changes (distortion, attenuation, etc.), which can make it unrecognizable.
The aim is to understand this evolution in order to properly recover the initial
message.
There are many other processes, which give different and apparently
unpredictable results, although they are observed using identical experimental
conditions. They are known as random processes, such as the receiver’s thermal
noise. The wide sense stationary random processes, which form a particularly
interesting class of these signals, are presented in Chapter 3. Some useful statistical
tools for testing different hypothesis about their parameters behavior are provided in
Chapter 4.
From a very general point of view, digital signal processing covers all the
operations, arithmetical calculations and number handling performed on the signal
to be processed, defined by a number series, in order to obtain a transformed number
series representing the processed signal. Very different functions can be carried out
in this way, such as classical spectral analysis (Chapter 10), time-frequency analysis
(Chapters 11 and 12), linear filtering (Chapters 7 and 8), detection and estimation
(Chapter 9), and feature extraction for information classification or compression
(Chapters 13 and 14).
André QUINQUIS
Chapter 1
Introduction
This digital simulation software enables a fast and simple visualization of the
obtained results.
MATLAB is especially designed for digital signal processing and for complex
digital system modeling and simulation. It is also suitable for processing data series,
images or multidimensional data fields.
The toolboxes extend the basic MATLAB functions and perform specific tasks
corresponding to different digital processing fields, such as image processing,
optimization, statistics, system control and identification, neural networks, fuzzy
systems, etc.
In order to run MATLAB, type the command matlab with UNIX shell (if a
MATLAB license under UNIX is available) or double click on the MATLAB icon if
the operating system is Windows. To exit MATLAB, type exit or quit. If
MATLAB is running under UNIX, you may have access to all UNIX commands
using just before the symbol! (example: !ls -l).
whos the same as previous, but lists more information about each variable
dir, chdir,
delete, load, similar to the corresponding DOS commands
save, type
i,j value of −1
Inf IEEE arithmetic representation for positive infinity (1/0)
NaN IEEE arithmetic representation for Not-a-Number (0/0)
nargin returns the number of function input arguments
nargout returns the number of function output arguments
input gives the user the prompt and then waits for input from the keyboard
The “online command” default operating mode is available after MATLAB gets
started. It displays the prompt >> and then waits for an input command. Running a
command usually results in creating one or several variables in the current
workspace, displaying a message or plotting a graph. For instance, the following
command:
v = 0:10
creates the variable v and displays its elements on screen. A semicolon has to be
added at the end of the statement if it is not necessary to display the result.
The previously typed commands can be recalled with the key ↑, while a
statement can be modified using the keys ← and →. You may also analyze the
effects on the command lines of the following keys: ↓, home, end, esc, del,
backspace and of the following key combinations: ctrl + →, ctrl + ←, ctrl + k.
Besides the “online command” operating mode, MATLAB can also create script
files and function files. Both of these are saved with the extension .m, but the
function files accept input arguments and return output arguments and operate on
variables within their own workspace.
In order to create a script file you have to select the menu File/New/M-file, while
to edit an existing file you have to first select File/Open M-file etc., and then choose
the appropriate file. After these commands, an edition session will be open using the
Introduction 9
chosen editor from Edit/View/Edit Preference. The edited file can be saved with the
menu File/Save As etc., followed by the file name (with the extension .m).
In MATLAB, many functions are predefined and saved as m-files. Some of them
are intrinsic, the others being provided by external libraries (toolbox): they cover
specific domains such as mathematics, data analysis, signal processing, image
processing, statistics, etc.
A function may use none, one or several input arguments and return none, one or
several output values. These different cases for a MATLAB function are called:
− one output value and no input argument:
variable_name = function_name
− no output value and one input argument:
function_name (argument_name)
− several output values and several input arguments:
[var_1, var_2, ...,var_n] = function_name (arg_1, arg_2, ...., arg_m)
For the last case, the first line of the file function_name.m has the following
form:
− function [var_1, var_2, ...,var_n] = function_name(arg_1, arg_2, ...., arg_m)
Usually, the input arguments are not modified, even if their values change during
the function execution. In fact, all the variables are local by default. Nevertheless,
this rule can be changed using the command: global variable_name.
In a MATLAB file, the comment lines have to begin with the symbol %.
The on-line help can be obtained using: help <function_name>. The first lines
of the file <function_name>.m beginning with % are then displayed. It is also
possible to search all the files containing a given keyword in their help using the
command: lookfor <keyword>.
NOTE.– The user-defined MATLAB files are recognized only in the current
directory, unlike the original MATLAB functions (toolbox, etc.). In order to make
available a user-defined file <file_name.m> outside the current directory you have
to type the command:
path(path,'<file_acces_path>/file_name>')
The data from the current workspace can be saved in a *.mat file using the
command save. They can be reloaded using the command load. (Type help save
and help load for more information).
Another possibility is to use the same procedure to manage the files as in the C
language:
Format
All the calculations are performed in MATLAB using the format double, but the
display format can be controlled using the function format (type help format).
Some examples are provided here after:
− format short: scaled fixed point format with 5 digits (default);
− format long: scaled fixed point format with 15 (7) digits for double (simple);
− format short e: floating point format with 5 digits;
− format long e: floating point format with 15 (7) digits for double (simple).
A vector is a one row or a one column matrix, while a scalar is a 1×1 matrix.
MATLAB is optimized for matrix calculations. You should try to use matrix
operation as much as possible instead of loops in order to save execution time and
memory space.
EXAMPLE
t = clock;
%Algorithm;
time = etime(clock,t)
EXERCISE 1.1.
Type a = 3 and then a = 3;
There are some predefined variables. For instance pi = π, while i and j are
defined as the square root of –1. Type a = 1+2*i.
Pay attention to the use of these keywords for defining new variables: any
assignment replaces the predefined value by the new input (for instance the
assignment pi = 3 replaces the value π). Type clear pi to recover the initial
value of this variable.
You should avoid assigning i and j other values in a MATLAB program which
handles complex numbers.
EXERCISE 1.2.
Type i = 2, then a = 1+2*i and finally clear i.
Elementary operations
An operation involving 2 variables is possible only if the corresponding matrix
sizes match.
EXERCISE 1.3.
Type v = [1 2 3] then v = [1; 2; 3] and v(1).
As opposed to the case of C language, where the array index begins with 0, in
MATLAB it begins with 1: see the effect of v(0).
A vector filled with equally spaced values is defined in the following manner:
initial_value:increment:final value (for example v = 4:-0.1:3.2).
12 Digital Signal Processing using MATLAB
The pointwise operators: ".*", "./" or ".^" are useful for performing matrix
operations.
EXERCISE 1.4.
Define the following matrix: A = [exp(j) 1; 2 j] and see A', A.', A^2,
A.^2.
The relational operators: <, <=, >, >=, ~= and == compare couples of
elements belonging to equal size matrices and return a matrix filled with 1 (true) and
0 (false).
The logical operators such as: &, |, ~, any or all consider all the non-zero
elements as true and return a matrix filled with 0 and 1, according to the logical
operation result.
Notice the difference between matrix right division and matrix left division:
X=A\B (equivalent to A-1*B) is the solution to A*X=B while X=A/B (equivalent to
A*B-1) is the solution to X*B=A.
EXERCISE 1.5.
A = [1 2 1; 2 1 3; 4 0 5];
y = [3; 2; 1];
x = A\y
z = A/y
The inverse submatrix extraction can be performed using brackets as indicated below:
EXERCISE 1.6.
Define a 4×3 matrix zero everywhere excepting the first line that is filled with 1.
m=
1 1 1
0 0 0
0 0 0
0 0 0
14 Digital Signal Processing using MATLAB
EXERCISE 1.7.
Consider the couples of vectors (x1, y1) and (x2, y2). Define the vector x so that:
function x = vectors(x1,y1,x2,y2)
x = x1.*[y1 == y2] + x2.*[y1 > y2];
ans =
-2 4
EXERCISE 1.8.
Generate and plot the signal: y(t) = sin(2πt) for 0 ≤ t ≤ 2, with an increment of
0.01, then undersample it (using the function decimate) with the factors 2 and 16.
t = 0:0.01:2;
y = sin(2*pi*t);
subplot(311)
plot(t,y) ;
ylabel('sin(2.pi.t)');
title('Original signal');
t2 = decimate(t,2);
t16 = decimate(t2,8);
y2 = decimate(y,2);
y16 = decimate(y2,8);
subplot(312)
plot(t2,y2);
ylabel('sin(2.pi.t)')
title('Undersampled signal with a factor 2');
subplot(313);
plot(t16,y16);
ylabel('sin(2.pi.t)');
xlabel('Time t');
title('Undersampled signal with a factor 16');
You can save the figures in eps (Encapsulated PostScript) format, which is
recognized by many software programs. The command print -eps file_name
creates the file file_name.eps.
Introduction 15
Original signal
1
0.5
sin(2 pi.t)
0
0.5
1
0 0.5 1 1.5 2
0.5
sin(2.pi.t)
0.5
1
0 0.5 1 1.5 2
0.5
sin(2.pi.t)
0.5
1
0 0.5 1 1.5 2
Time t
EXERCISE 1.9.
Plot the paraboloid defined by the equation: z2 = x2 + y2 for -50 ≤ x, y ≤ 50.
for k = 1: 2*N+1
z2(k,:) = sqrt(x(k)^2 + y.^2); % pointwise multiplication
for y
end;
figure; meshc(x,y,z2);
xlabel('x'); ylabel('y'); zlabel('z');
fprintf('Type a key to plot the paraboloid using another
method\n'); pause;
% third solution (the best): no loop
%---------------------------------------------
xc = x.^2; yc = y.^2;
mx=xc.'*ones(1,2*N+1); % line k of mx filled with the value
xc[k]
my=ones(1,2*N+1).'*yc; % column l of my filled with the value
yc[l]
z3 = sqrt(mx + my);
figure; meshc(x,y,z3);
xlabel('x'); ylabel('y'); zlabel('z');
80
60
40
z
20
0
50
50
0
0
y 50 50
x
EXERCISE 1.10.
1. Generate 1,000 independent values x1,...,x1,000 of a zero-mean random
Gaussian variable with variance 4 using the function randn.
Plot the corresponding histogram and calculate the mean and the standard
deviation of the generated series using the functions hist, mean and std.
Find out the mean and the standard deviation of the random series x21, …,x21,000.
Then compare the obtained results with the theoretical results.
Introduction 17
clear all
n = 1000;
250
Number of values belonging to each bin
200
150
100
50
0
8 6 4 2 0 2 4 6 8
Bins
Mean of X = 0.0085986
St. dev. of X = 1.963
Variance of X = 3.8533
Mean of X = 0.00860
St. dev. of X = 1.96298
Variance of X = 3.85328
Mean of Z = 3.84950
St. dev. of Z = 5.55695
Variance of Z = 30.87972
Var Z - 2*(Var X)^2 = 1.18418
2. Use the function rand to generate 1,000 independent values of the random
variable X defined by:
P ( X = −1) = p 0 ; P( X = 0) = p1 ; P ( X = 1) = 1 − p 0 − p1 ;
function va_gen(n,po,p1)
help va_gen; Y = rand(1,n);
X = -1*[Y< po*ones(1,n)] + 1*[Y>((po+p1)*ones(1,n))];
% If Y is a uniformly distributed variable between 0 and 1, then the X
current value is obtained from the combination of 2 tests, so that X = -
1*(Y<p0) + 1*(Y>p0+p1):
% - if Y < p0 (this case occurs with the probability p0) then
% the first test is true and the second is false, so X = -1
% - if Y > p0+p1 (this case occurs with the probability 1-p0-p1)
% then the first test is false and the second is true, so X = 1
% - if p0 < Y < p0+p1 (this case occurs with the probability p1)
% then the two tests are false, so X = 0
prob = hist(X,3)/n;
fprintf('\np [X = -1] = %1.4f\n', prob(1));
fprintf('p [X = 0] = %1.4f\n', prob(2));
fprintf('p [X = 1] = %1.4f\n\n', prob(3));
- if p0 < Y < p0+p1 (this case occurs with the probability p1)
then the two tests are false, so X = 0
p [X = -1] = 0.1000
p [X = 0] = 0.4840
p [X = 1] = 0.4160
EXERCISE 1.11.
Plot in polar coordinates the poles of the filter having the following transfer function:
1
H ( z) =
−1
1 + az + bz −2
The values of a and b are entered by the user and the function returns the poles.
(use the commands roots and polar).
function c = filter_bis(a,b)
c = roots([1 a b]); % Comment: H(z) = poly(c)
fprintf('The poles are:\n'); z1 = c(1,:)
z2 = c(2,:)
if (abs(z1)> 1 | abs(z2) > 1)
fprintf ('There is at least an instable pole\n');
else
clf; figure; polar(angle(z1),abs(z1),'r+');
% Second solution: use zplane
hold on; polar(angle(z2),abs(z2),'r+');
legend('Polar plot of H(z) poles',0);
end
90
1
120 60
08
06
150 30
0.4
0.2
180 0
210 330
240 300
270
Polar plot of H(z) poles
z1 =
-0.7500 + 0.6614i
z2 =
-0.7500 - 0.6614i
EXERCISE 1.12.
Generate the signal: x(t) = A⋅sin(2πft + φ) + b(t), t = 0..1024, where φ is a uniformly
distributed random variable on [0, 2π] and b(t) is a white Gaussian noise with mean zero
and variance one (use rand and randn). A and f are chosen by the user.
Estimate the mean value, the autocorrelation function (xcorr) and the spectrum
of x(t) using the periodogram and the correlogram (use fft and fftshift).
Compare the obtained results to the theoretical results. Change A in order to control
the SNR.
function noisy_sin(A,f)
N = 1024; % Number of calculated frequencies
nech = 1024; % Number of samples
t = 0:nech;
b = randn(1,nech+1);
phi = 2*pi*rand(1);
x = A*sin(2*pi*f*t+phi)+b;
fprintf('\nMean of x(t) = %2.4f\n',mean(x));
fprintf('Mean of b(t) = %2.4f\n',mean(b));
cx = xcorr(x);
% plot(cx);
% Correlogram based spectrum estimation:
sx_correlo = (abs(fft(cx,N))).^2;
sx_correlo = sx_correlo / max(sx_correlo);
% the first N/2 values correspond to 0<=f<0.5
% the last N/2 values correspond to 0.5<=f<1 (or -0.5<=f< 1)
sx_correlo = fftshift(sx_correlo);
% The spectrum is centred around 0:
% the first N/2 values correspond to -0.5<=f<0
% the last N/2 values correspond to 0<=f<0.5
vector(1:N) = sx_periodo;
vector(N+1:2*N) = sx_correlo;
plot(-0.5:1/N:0.5-1/N,10*log10(sx_correlo(1:N)),'r-',-0.5:1/N:0.5-
1/N,10*log10(sx_periodo(1:N)),'b:');
legend('Correlogram','Periodogram',0);
xlabel('Normalized frequency');
ylabel('Magnitude spectrum [dB]');
axis([-0.5 0.5 min(10*log(vector)) 0]);
SNRth = A^2/2;
background_noise1 = mean(10*log10(sx_periodo(1:round(N*(0.45-f)))));
background_noise2 = mean(10*log10(sx_periodo(round(N*(0.65+f)):N)));
mean_background_noise=mean([background_noise1,background_noise2]);
The SNR estimation error is related to several odd spectrum values, which lead
to a biased mean background noise level.
0
Correlogram
Periodogram
10
20
Magnitude spectrum [dB]
30
40
50
60
70
80
0.5 0 0.5
Normalized frequency
Discrete-Time Signals
Usually, s(k) stands for the kth sample of the discrete-time signal {s(k)}k = 1, 2, .
However, the two notations usually overlap in order to simplify the theoretical
presentation.
x : T → X , n → x [n] [2.1]
so that:
∀ n ∈ T ⊆ N or Z x [ n ] ∈ X ⊆ N , R or C [2.2]
N −1
X ( z) = ¦ xn z n = x0 + x1 z + x2 z 2 + ... + x N −1 z N −1 [2.4]
n=0
{ }
x = x ( n1 ,n2 ) or xn1 ,n2 with n1 = 0..N ′ − 1 and n2 = 0..N ′′ − 1 [2.5]
N ′′−1
X n1 ( z ) = ¦ xn1 ,n2 z n2 with n1 = 0..N ′ − 1 [2.6]
n2 =0
N ′ −1 N ′′ −1
X ( z1 , z 2 ) = ¦
n n
¦ x n1 , n2 z1 1 z 2 2 [2.7]
n1 = 0 n2 = 0
Discrete-Time Signals 25
1D 2D
Dirac pulse
1, if n = 0 1, if n1 = n2 = 0
δ [ n] = ® , δ [ n1 , n2 ] = ® ,
¯0, otherwise ¯0, otherwise
so that: so that:
x[n] = ¦ x[r ] δ [n − r ] x[n1 , n2 ] = ¦ ¦ x[r1 , r2 ] δ [n1 − r1 , n2 − r2 ]
(r ) ( r1 ) ( r2 )
Step signal
1, if n ≥ 0 1, if n1 , n2 ≥ 0
u [ n] = ® u [ n1 , n2 ] = ®
¯0, otherwise ¯0, otherwise
∞ ∞ ∞
and: u[n ] = ¦ δ [n − r ] and: u[n1 , n2 ] = ¦ ¦ δ [n1 − r1 , n2 − r2 ]
r =0 r1 = 0 r2 = 0
ϕk [ n ] = {e jkω0 n
}, {
ϕ k1 , k 2 [n1 , n2 ] = e jk1ω 01 n1 e jk 2ω 02 n 2 }
where: k = 0..N − 1 where: k1 = 0. N1 − 1 and k2 = 0. N 2 − 1
N , i = j N1 N 2 , i1 = j1 = i2 = j2
and: ϕ i , ϕ j = ® and: ϕ i1 , i 2 , ϕ j1 , j 2 =®
¯0, i ≠ j ¯0, i1,2 ≠ j1,2
Set of orthonormal complex signals
1 ½ ° 1 ½°
® ϕk [ n ]¾ , k = 0..N − 1 ® ϕk1 ,k2 [ n1 , n2 ]¾ , k1,2 = 0..N1,2
¯ N ¿ °¯ N1 N 2 °¿
Harmonic analysis is the most important tool in signal analysis theory. The
generalized Fourier transform, which makes use of distributions, allows the spectral
representation of deterministic signals to be obtained. This describes the frequency
distribution of the signal amplitude, phase, energy or power.
N −1
x [ n ] = x [ n + N ] = ¦ ck exp ª¬ jk ( 2π N ) n º¼ [2.8]
k =0
where:
1 N −1
ck = ¦ x [ n] exp ª¬ − jk ( 2π N ) n º¼, k = 0..N − 1 [2.9]
N n =0
x [ n1 , n2 ] = x [ n1 + N1 , n2 ] = x [ n1 , n2 + N 2 ] =
N1 −1 N 2 −1 § 2π 2π · [2.10]
= ¦ ¦ ck1 ,k2 exp ¨ jk1 n1 + jk2 n2 ¸
k1 =0 k2 =0 © N1 N2 ¹
where:
1 N1 −1 N 2 −1 § 2π 2π ·
ck1 ,k2 = ¦ ¦ x [ n1 , n2 ] exp ¨ − jk1 n1 − jk2 n2 ¸
N1 N 2 n1 =0 n2 =0 © N1 N 2 ¹ [2.11]
k1 = 0..N1 − 1, k2 = 0. N 2 − 1
DTFS1D DTFS2D
x [ n ] ←⎯⎯⎯ → ck , x [ n1 , n2 ] ←⎯⎯⎯ → ck1k2 [2.12]
1 Different notations are sometimes used for periodic ( x [n] or x [n1, n2]) and non-periodic
discrete-time signals (x[n] or x[n1, n2]).
Discrete-Time Signals 27
+∞
( )
X e jω =DTFT1D x [ n ] = { } ¦ x [ n ] exp ( − jω n )
n =−∞
[2.13]
x [ n ] =DTFT1D
−1
X e jω{ ( )} = 21π v³ X ( e ) e
2π
jω jω n
dω [2.14]
( )
X e jω1 + jω2 = X (ω1 , ω2 ) = DTFT2D x [ n1 , n2 ]{ }
+∞ +∞ [2.15]
= ¦ ¦ x [ n1 , n2 ] exp [ − jω1n1 − jω2 n2 ]
n1 =−∞ n2 =−∞
1
x [ n1 , n2 ] = v³ v³ X (ω1 , ω2 ) exp [ jω1n1 + jω2 n2 ] d ω1 d ω2 [2.16]
( 2π )2 2π 2π
x [ n ] ←⎯⎯⎯
1DDTFT
( )
→ X e jω = X (ω ) , x [ n1 , n2 ] ←⎯⎯⎯
2D DTFT
→ X (ω1 , ω2 ) [2.17]
It is well known that the Fourier transform of a real signal has the Hermitian
symmetry property (odd absolute value and real part, even argument and imaginary
part). This means that giving the Fourier transform (FT) of a real signal for the
positive frequency axis is enough for its complete characterization.
It is thus possible to represent a real signal x(t) by a complex one zx(t), without
any information loss. The new complex signal zx(t) is called the analytic signal
associated with the real signal x(t).
28 Digital Signal Processing using MATLAB
Generally, a signal z(t) is an analytic signal if its spectrum Z(ν) is zero for any
negative frequency value. Bearing in mind that Z(ν) = Z(ν)U(ν), where U(ν) stands
for the frequency step function, it can be easily shown that the real and imaginary
parts of z(t) are a couple of the Hilbert transform. An analytical signal is therefore
completely determined if its real part is known.
{ } ( ) ( )
DTFT1D x [ n ] = X e jω = X Re e jω + jX Im e jω ( )
The real and imaginary parts of this DTFT are related by the Hilbert transform
(HT):
° 1 +π θ − ω ½°
( )
X Im e jω = PV ®
¯° 2π
³
−π
( )
X Re e jθ cot
2 ¿°
{ ( )} [2.18]
d θ ¾ = HT1D X Re e jω
° 1 +π θ − ω ½°
( )
X Re e jω = −PV ® ³
¯° 2π −π
( )
X Im e jθ cot
2
d θ ¾ + x [ 0]
¿° [2.19]
{ ( )} + x [0]
= −HT1D X Im e jω
where “PV” denotes the principal value of an integral and the Hilbert transform is
defined by:
° 1 π § θ − ω · °½
HT1D { f } (ω ) = PV ® ³ f (θ )cot ¨ ¸ dθ ¾ [2.20]
°¯ 2π −π © 2 ¹ °¿
( )
X e jω = 0, −π ≤ ω < 0 [2.21]
x[n] is thus an analytical signal and can be written in the following form:
The relationship between its real and imaginary parts can be easily derived:
+∞
{
xim [ n ] = ¦ xre [ m ] h [ n − m ] = DHT1D xre [ n ] } [2.23]
m =−∞
+∞
xre [ n ] = − ¦ xim [ m] h [ n − m] = −DHT1D { xim [ n] } [2.24]
m =−∞
0, if n = 0
°
h [ n ] = ® 2 sin 2 (π n 2 ) [2.25]
° , if n ≠ 0
¯π n
EXERCISE 2.1.
The MATLAB code below generates and plots some basic discrete-time signals.
subplot(3,3,1);
stem([1;zeros(49,1)]);
title('Dirac pulse')
subplot(3,3,2); stem(ones(50,1));
title('Step function')
subplot(3,3,3);
stem([ones(1,5),zeros(1,3)])
title('Rectangular pulse')
subplot(3,3,4);
stem(sin(2*pi/8*(0:15)))
title('Sinusoidal signal')
subplot(3,3,5); stem(sinc(0:0.25:8));
title('"Sinc" signal')
subplot(3,3,6); stem(exp(-(0:15)));
title('e^-^n signal')
subplot(3,3,7);
stem(pow2(-0.5*(0:15)))
title('2^-^0^.^5^n signal')
subplot(3,3,8); stem(3.^(0:15));
title('3^n signal')
subplot(3,3,9); stem(randn(1,16));
title('Gaussian random signal')
30 Digital Signal Processing using MATLAB
0 0 0
0 50 0 50 0 5 10
n
Sinusoidal signal "Sinc" signal e signal
1 1 1
0 0 0.5
1 1 0
0 10 20 0 20 40 0 10 20
0 5n n
2 signal x 10 3 signal
7 Gaussian random signal
1 2 2
0.5 1 0
0 0 2
0 10 20 0 10 20 0 10 20
EXERCISE 2.2.
Generate the following signal:
x(n) = K ⋅ exp[c ⋅ n] ,
c = -(1/12)+(pi/6)*i;
K = 2; n = 0:40;
x = K*exp(c*n);
subplot(2,1,1); stem(n,real(x));
xlabel('Time index n');
ylabel('Amplitude');
title('Real part');
subplot(2,1,2); stem(n,imag(x));
xlabel('Time index n');
ylabel('Amplitude');
title('Imaginary part');
Discrete-Time Signals 31
Real part
2
1
Amplitude
2
0 5 10 15 20 25 30 35 40
Time index n
Imaginary part
2
1
Amplitude
1
0 5 10 15 20 25 30 35 40
Time index n
K is a constant amplitude factor and Re{c} sets the attenuation, while Im{c} is
related to the dumped signal period (12 points per period).
EXERCISE 2.3.
Generate the following amplitude modulated signal:
n = 0:100; m = 0.4;
fH = 0.1 ; fL = 0.01;
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
stem(n,y); grid ;
xlabel('Time index n');
ylabel('Amplitude');
Other documents randomly have
different content
egli faceva perdere la memoria ai testimoni, e ingarbugliava le idee
ai giudici, e metteva la stracchezza addosso ai carnefici. Tutto veniva
da lui. Se la strega durante la tortura moriva, era il diavolo che
l'aveva strozzata, per impedirle di parlare; se la strega si uccideva da
sè stessa, era il diavolo che a ciò l'aveva spinta, affinchè non si
potesse più fare il processo. In Lindheim, villaggio dell'Assia, cinque
o sei donne furono accusate d'aver dissotterrato un bambino e
d'essersene servite per la manipolazione della consueta broda delle
streghe. Torturate in regola, esse confessarono il delitto. Allora il
marito di una di esse tanto s'adoperò che potè ottenere si facesse
una visita al camposanto, per meglio accertarsi della cosa. Aperta la
fossa, il corpicino apparve intatto nella sua bara; ma l'inquisitore,
senza punto smarrirsi, disse che quella doveva essere una illusione
del diavolo maledetto, e che essendoci la confessione delle colpevoli
non era da cercar altro, ma era da dar corso alla giustizia, a onore e
gloria della santissima Trinità: e le donne furono bruciate vive.
Per render vane le frodi e le gherminelle del diavolo, si usavano in
varii luoghi varii accorgimenti e rimedii: si vestiva la strega di una
camicia tessuta e cucita in un sol giorno, le si dava bere un intruglio
fatto di cose benedette, si aspergevano d'acqua benedetta gli
stromenti di tortura, si bruciavano certe erbe, ecc. ecc. Fosse in
grazia di tali pratiche, fosse per altra ragione, certo si è che assai di
rado riusciva il diavolo a porgere alle streghe e agli stregoni amici
suoi ajuto veramente efficace e durevole. Lo storico siciliano
Tommaso Fazello (1498-1570) narra di certo mago Diodoro, che
ajutato dal diavolo scappava di mano alle guardie, e volava per l'aria,
da Catania a Costantinopoli. Il giuoco durò un pezzo; ma finalmente
il vescovo Leone potè mettergli le mani addosso, e lo fece gettar
vivo in una fornace ben accesa, d'onde quegli non uscì più, o uscì
solo per andar capofitto in inferno.
Il primo a insorgere contro la odiosa superstizione, e contro gli
orribili effetti suoi, fu nel secolo XVI il famoso Cornelio Agrippa di
Nettesheim, seguito e superato dal suo proprio discepolo Giovanni
Weier (1518-88) il cui libro fa epoca. I difensori della retta ragione e
della umanità si moltiplicarono poi rapidamente; ma la battaglia da
essi combattuta non fu coronata di vittoria se non assai tardi. Le
ultime vittime della superstizione caddero in Europa nella seconda
metà del secolo scorso: fuori d'Europa, nel Messico, due roghi si
accesero ancora nel 1860 e nel 1873.
L'Inquisizione è morta, e sono finiti i processi per istregoneria; ma
non è morta la stolta credenza, nè sono finiti i lamenti di coloro che
la serbano viva; e non passa anno senza che venga alla luce, scritto
da un qualche teologo fallito e frenetico, un libro in cui si grida che il
mondo è nelle mani del diavolo, e che i satelliti del diavolo,
ammaestrati da lui, corrompono con l'arti loro ogni cosa, insidiano e
sopraffanno i buoni. Il mondo è pieno di stregoni, camuffati in altra
maniera, ma non meno tristi e pericolosi degli antichi, e, quel ch'è
peggio, il diavolo, lor buon signore, ha finalmente trovato il modo
d'impedire che sieno bruciati. Se si potessero ancora bruciare, a
tutto ci sarebbe rimedio.
Capitolo X.
L'INFERNO.
Essa è il cieco mondo, il loco d'ogni luce muto, la cui eterna caligine
è rotta solo dai sanguigni lampeggiamenti di quei nembi e vortici di
fiamme, dal corruscare delle brage ammontate, dei metalli colati.
Non mancò del resto chi disse il fuoco infernale aver l'ardore e non
la luce, esser nere le fiamme che mai non si spengono.
Il regno della morta gente è vasto e profondo, come si conviene
all'infinito popolo che vi si accoglie. In un antico poema
anglosassone si dice che Cristo ordinò a Satana di misurarlo, e
Satana trovò che dal fondo alla porta correvano 100,000 miglia.
Giova per altro avvertire che il gesuita Cornelio a Lapide (1566-
1637), autore di dieci volumi di commento sopra la Sacra Scrittura,
afferma non avere l'inferno più di dugento miglia italiane di
larghezza. Un buon teologo tedesco andò più in là e calcolò che una
capacità di un miglio per ogni verso basta a centomila milioni
d'anime dannate, le quali non hanno già a stare al largo e a loro
agio, ma le une sulle altre, pigiate, come le acciughe nel barile, o gli
acini dell'uva nel tino.
Dante ci descrive un inferno geometricamente costruito, diviso in
cerchi, che facendosi sempre più angusti, vanno digradando verso il
centro della terra. Tale struttura si ritrova in alcuni degli imitatori del
divino poeta, ma non in quelli che si possono in qualche modo
chiamare precursori suoi, negli autori delle Visioni. Qui l'inferno
descritto rassomiglia a una regione terrestre, salvo che è più orribile
assai d'ogni più orribile luogo che conoscano gli uomini, e non vede
mai lume di cielo. Vi si trovano montagne dirupate ed ignude, valli
asserragliate e ronchiose, precipizii spalancati, foreste d'alberi strani,
laghi color di bitume, paludi putride e tetre. Lo traversano per lungo
e per largo fiumi pigri o impetuosi, alcuni dei quali scaturiti dalle
viscere dell'Averno antico, l'Acheronte, il Flegetonte, il Lete, il Cocito,
lo Stige, che anche Dante descrive, o ricorda.
Non mancavano nel doloroso regno le città e le castella. Dante
dipinge la città di Dite, vallata d'alte fosse, con le torri eternamente
affocate, con le mura di ferro. Spesso l'inferno tutto intero è
considerato come una gran città, che prende il nome di Babilonia
infernale, e si oppone alla Gerusalemme celeste, come Satana si
oppone a Dio. Immaginate, dice san Bonaventura, una città vasta ed
orribile, profondamente tenebrosa, accesa di oscurissime e
terribilissime fiamme, piena di clamori spaventevoli e di urla
disperate; tale è l'inferno. Un poeta francescano del secolo XIII,
Giacomino da Verona, descrisse in due suoi poemi assai rozzi, ma
accesi di fede, le due città contrarie, l'una a riscontro dell'altra. La
Gerusalemme celeste è cinta d'alte mura, fondata di pietre preziose,
munita di tre porte più lucenti che stelle, adorna di merli di cristallo.
Le sue vie e le sue piazze sono lastricate d'oro e d'argento; i palazzi
risplendono nello sfoggio dei marmi, dei lapislazzuli, dei metalli
preziosi. Acque cristaline corrono per ogni banda e dànno alimento
ad alberi meravigliosi, a fiori soavissimi: l'aria pervasa da un lume
divino, è tutta un olezzo, e vibra di armonie sovrumane. Ben diversa
da quella è la Babilonia infernale.
L'inferno c'è per comun punizione dei dannati e dei diavoli, dei
tormentati e dei tormentatori. Satana ha in se più qualità e più
officii, che pajono, a primo aspetto, non potersi conciliare fra loro.
Cagion prima del male nel mondo, suscitatore instancabile di
peccato, e seduttore perpetuo di anime, egli è nel tempo stesso il
gran giustiziere, egli è colui per la cui opera il male è represso e il
peccato si espia.
Non è così picciolo atto, nè così tenue pensiero, nella vita e nella
mente degli uomini, di cui i demonii non serbino memoria, quando
siavi in quelli alcuna parte, alcun fermento di colpa. Sant'Agostino
vide una volta un diavolo che recava sulle spalle un grandissimo
libro, dove erano notati per ordine tutti i peccati degli uomini. Più
spesso c'era per ogni singolo peccatore un particolar volume,
ponderoso e tetro, che i diavoli portavano ostentatamente in
giudizio, opponendolo al piccioletto ed aureo in cui l'angelo custode
aveva amorosamente descritte le azioni buone e meritorie, e
scaraventandolo talora, con iscalpore e con ira, in uno dei piatti della
bilancia divina. In più chiese del medio evo, come, per esempio nel
duomo di Halberstadt, si vede dipinto il diavolo che scrive i nomi di
coloro i quali dormono nella casa di Dio, o chiacchierano, o in altro
modo non serbano il contegno dovuto. Nella vita di sant'Aicadro si
legge che avendo un pover uomo osato di tagliarsi i capelli in giorno
di domenica, fu veduto, appiattato in un angolo della casa, il diavolo,
che frettolosamente scriveva il peccato sopra un foglietto di
pergamena.
Di regola il peccatore indegno di misericordia è punito in inferno; ma
talvolta Satana, coltolo sul fatto, anticipa la vendetta divina e lo
castiga mentre è ancor vivo. Gli uccisori di san Regolo, vescovo,
furono strozzati, l'assassino di san Godegrando fu portato via dal
diavolo; certa donna di mala vita, che voleva trascinare al peccato
sant'Elia Speleota, fu da lui conciata pel dì delle feste. Se non mente
lo storico Liutprando, il pessimo pontefice Giovanni XII fu
ammazzato a furia di legnate dal diavolo, che lo colse in letto, fra le
braccia di una concubina; e sì che il pontefice usava, mentr'era vivo
e sano, di bere alla salute di colui che doveva fargli fare così misera
fine. Fra Filippo da Siena racconta la terribile storia di certa donna
non meno vana che leggiadra, usa di spendere l'ore in lisciarsi ed
ornarsi, la quale fu una bella volta lisciata dal diavolo, e sfigurata in
modo che di vergogna e di paura se ne morì. Ciò avvenne in Siena,
l'anno di grazia 1322. Ai 27 di maggio del 1562, alle sette ore di
sera, nella città di Anversa, il diavolo strangolò una fanciulla, che
invitata a nozze, aveva osato comperare certa tela a nove talleri il
braccio, per farsene uno di quei collari crespi a ventaglio, come
usavano allora. Spesso il diavolo picchia, strozza, o porta via chi si
mostra irriverente alle reliquie, o deride le sacre cerimonie; entra in
corpo a chi assiste distrattamente alla messa; rimprovera ad alta
voce, con gran confusione dei colpevoli, peccati secreti. Spesso il
furore diabolico non si cheta se non dopo essersi esercitato anche
sul cadavere del peccatore, e molte orribili storie si raccontano di
corpi che furono strappati a furia fuor delle chiese, o bruciati negli
avelli, o lacerati a brani.
Santa Teresa chiese una volta a Dio di poter fare, per propria
edificazione, un piccolo saggio delle pene dell'inferno. Le fu
conceduta la grazia, e dopo sei anni il ricordo dello strazio sofferto la
gelava ancora di terrore. Sono molte le storie in cui si narra di
dannati usciti per breve ora dall'inferno, a solo fine di dare a' vivi
alcun segno delle inenarrabili torture a cui vanno soggetti. Jacopo
Passavanti racconta quella di Ser Lo, maestro di filosofia in Parigi, e
di certo suo scolare, “arguto e sottile in disputare, ma superbo e
vizioso di sua vita,„ il quale essendo morto, apparve dopo alquanti
giorni al maestro, e gli disse d'essere dannato, e per fargli conoscere
in qualche modo l'atrocità dei tormenti che pativa, scosse un dito
sovra la palma della mano di lui, facendovi cadere una piccola goccia
di sudore, che “forò la mano dall'uno lato all'altro con molto dolore e
pena, come fosse stata una saetta focosa et aguta.„
Le pene infernali sono, al dir dei teologi, non solo continue nel
tempo, ma continue ancora nello spazio, in questo senso, che non è
nel dannato neppur una minima particella che non soffra intollerabile
strazio, e sempre egualmente intenso. Strumento principale di pena
è il fuoco. Origene, Lattanzio, san Giovanni Damasceno, credettero
che il fuoco infernale fosse un fuoco puramente ideale e metaforico;
ma la grande maggioranza dei Padri tenne contraria opinione, e
sant'Agostino disse che se i mari tutti della terra confluissero in
inferno non potrebbero temperarvi l'ardore delle orribili fiamme che
perpetuamente vi divampano. Oltre il fuoco v'è il ghiaccio, vi sono i
venti impetuosi e le piogge dirotte, vi sono animali orribili, e mille
qualità di tormenti, che i diavoli inventano e adoprano. San
Tommaso prova che i diavoli hanno il diritto e il dovere di tormentare
i dannati; che essi fanno quanto possono per ispaventarli e torturarli,
e che per giunta li deridono e li scherniscono. La pena maggiore ad
ogni modo viene ai dannati dall'esser privi in eterno della beatifica
visione di Dio, e dall'aver conoscenza della letizia dei santi. Su
quest'ultimo punto per altro gli scrittori non troppo si accordano,
essendovene alcuni i quali affermano che i santi vedono le pene dei
reprobi, ma questi non vedono il gaudio di quelli. San Gregorio
Magno assicura che le pene dei dannati sono agli eletti gradito
spettacolo, e san Bernardo di Chiaravalle si scalmana a dimostrare
che i beati godono dello spettacolo che i tormenti dei dannati offrono
alla lor vista, e ne godono per quattro ragioni propriamente: la
prima, perchè quei tormenti non toccano a loro; la seconda, perchè
dannati tutti i rei, non potranno i santi più temere malizia alcuna, nè
diabolica, nè umana; la terza, perchè la loro gloria apparirà, per
ragion di contrasto, maggiore; la quarta, perchè ciò che piace a Dio
deve piacere ai giusti.
E certo lo spettacolo era tale, per varietà ed intensità, da appagare
qualsivoglia più difficile gusto. Procuriamo di farcene spettatori
anche noi un istante, almeno con la fantasia, e a tal fine mettiamoci
dietro a qualcuna di quell'anime pellegrine ch'ebbero in sorte di
visitare il regno della morta gente.
ma gli angeli, gli astor celestiali, lo volgono in fuga. Sia qui notato di
passaggio che le pene del purgatorio furono da taluno credute più
aspre che non quelle dell'inferno, e ciò perchè non duravano eterne,
come l'altre duravano.
Le reliquie dei santi che avevano trionfato di tutti gli assalti e di tutte
le insidie di Satana, ajutavano altri infiniti a conseguire consimili
trionfi, e lo stesso dicasi di certi brevi benedetti, da portare appesi al
collo, o cuciti nei panni, e di certi amuleti. Nè mancavano cose
puramente naturali, le quali erano contrarie e nocive ai diavoli; tali
alcune gemme, come il crisolito e l'agata, che li volgevano in fuga, e
il zaffiro, che riconciliava con Dio; tali certe piante, come l'aglio e la
ruta, e un'erba detta dai francesi permanable, che aveva virtù
d'incantare i demonii. Il sale era una delle cose di cui questi si
mostravano più paurosi. Il gallo era, come già s'è notato, un loro
grande avversario, e con la mattutina sua strombettata, foriera del
giorno, li forzava (ma non tutti) a nascondersi. Finalmente, in certi
casi, il cristiano poteva anche usare felicemente, come vedremo,
delle sue braccia e di un buon bastone. Chi poi era caduto in signoria
del nemico poteva, con penitenze più o meno aspre e lunghe,
riscattarsi e mettersi sotto i piedi il tristo padrone.
Tuttavia è da dire che quelle armi e quei ripari non sempre
giovavano, come per chiari esempii si può vedere nelle vite di molti
santi, non pur dei minori e dei mezzani, ma degli eccellentissimi.
Accadde assai volte, qual che ne fosse la cagione, che i diavoli
sfacciati e protervi, ripeterono parola per parola, con ischerno, le
sante orazioni con cui altri s'ingegnava di tenerli in rispetto, e i salmi
stessi del libro sacro; che ghignarono atrocemente alla vista di quella
croce a cui di solito volgevano, fuggendo, le spalle; che trescarono
tripudiando sotto l'aspersorio, e che tanto più gli assalti loro
diventarono rabbiosi e frequenti, quanto maggiori furono le difese.
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookgate.com