3.5 QAM Demodulation Using Complex-Valued Signals
3.5.1 PAM-based detector scheme for square QAM
3.4MatlabOctaveFunctions/ak_qamdemod.m
3.5.2 QAM demodulation of complex-valued signals with lowpass filter
3.7 QAM demodulation using lowpass filter that operates on complex-valued signals.3.5 MatlabOctaveBookExamples/ex_qam_demodulation_lowpass.m3.6MatlabOctaveCodeSnippets/snip_digi_comm_QAM_result.m
3.5.3 Advanced: QAM demodulation of complex-valued signals via phase splitter
3.8 QAM demodulation using complex-valued signals: the analytic signal (middle plot) is downconverted to obtain the complex envelope (bottom). Only XQAM(f) presents Hermitian symmetry.3.9 Phase splitter as used in QAM demodulation.3.10 QAM demodulation using a Hilbert filter incorporated to a phase splitter.3.11 Magnitude (top) and phase (middle) of a 52-th order FIR Hilbert filter. The bottom plot is obtained by removing the linear phase factor.3.7 MatlabOnly/snip_digi_comm_hilbert_filter_design.m3.8MatlabOctaveCodeSnippets/snip_digi_comm_hilbert_filter_analysis.m3.9MatlabOctaveBookExamples/ex_qam_demodulation_hilbert.m3.10MatlabOctaveBookExamples/ex_qam_demodulation_complex.m3.11MatlabOctaveCodeSnippets/snip_digi_comm_ifft_qam_recover.m
3.6 Quadrature (or IQ) Sampling
3.12 Possible scheme for quadrature sampling. The amplifiers and DDCs are optional.
3.7 Baseband Representations of Signals and Passband Channels
3.8 Orthogonal Modulations and FSK
3.13 Example of FSK constellation with N = 2 dimensions and M = 2 symbols.3.14 Example of FSK constellation with N = 3 dimensions and M = 3 symbols.
3.9 Applications
3.15 Input binary image of dimension 60 × 60 pixels.3.16 FSK constellations.3.17 Characterization of the transmission channel for the QAM example.3.12 MatlabOctaveCodeSnippets/snip_digi_comm_upconverted_power.m3.18 Transmitted signal for the QAM example.3.19 Transmitted signal in frequency domain. Two alternative views of the PSD are provided for the baseband signal.3.13 MatlabOctaveCodeSnippets/snip_digi_comm_freq_domain.m3.20 Received signal for the QAM example.3.14 MatlabOctaveCodeSnippets/snip_digi_comm_digital_transmission.m3.21 Intermediate results along a QAM demodulation process: synchronization via cross-correlation and equalization of received symbols.
3.10 Comments and Further Reading
3.11 Exercises
4 Channels: Modeling, Simulating and Mitigating their Effects
4.1 What You Will Learn
4.2 Channel Models
4.2.1 LTI Gaussian channel
4.1 Block diagram of a LTI Gaussian channel.4.1 Some channel features related to Eq. (ø:ref eq:filtered_awgn_channel) and associated remedies.
4.2.2 Flat-fading channel
4.2 Flat-fading channel block diagram.
4.2.3 Discrete-time scalar AWGN
4.3 Mind map with a possible taxonomy of AWGN channels.4.1 MatlabOctaveCodeSnippets/snip_digi_comm_gaussian_noise.m
4.2.4 Discrete-time vector AWGN
4.4 AWGN vector channel, where s, r and ν are vectors of dimension D.
4.2.5 Continuous-time AWGN channel
4.5 Continuous-time AWGN channel, which has the implicit assumption that s(t) is both power and bandwidth-limited.4.6 Lowpass (baseband) and bandpass continuous-time AWGN channels.
4.2.6 LTI channel with non-white additive noise
4.7 Two equivalent representations of non-white noise, where H(f) is such that outputs a signal with PSD Sν(f) when its input is WGN.4.8 Signal processing trick to convert any AWN system into an equivalent AWGN.
4.3 Optimal Receivers for AWGN: Matched Filters or Correlators
4.3.1 Motivation to matched filtering
4.3.2 Relation between matched filtering and correlative decoding
4.9 Example of matched filter when the support of p(t) is [0,3] s and Tsym = 5 s.
4.3.3 Orthogonal expansion of white Gaussian noise
4.10 Correlative decoding when the received signal is only WGN ν(t).
4.3.4 SNR at the output of a continuous-time matched filter
4.3.5 Discrete-time matched filtering
4.3.6 Characteristics of the matched filter
4.3.7 Simulations with matched filtering
4.11 Matched filtering (MF) without noise for 4-PAM (m ∈{−1,1,−3,3}).4.12 Version of Figure ø:ref fig:mfWaveformsNoNoise that also shows the received (Rx) signal.4.13 Matched filtering with AWGN noise at SNRin = 0.72 dB for 4-PAM ( − 1,1,−3,3).4.2 Sample-based simulation of matched filtering4.14 Matched filtering result. Note the better results when compared to Figure ø:ref fig:serberWaveformSimulationOfPAMInAWGN.4.15 Comparison of Figure ø:ref fig:serberWaveformSimulationOfPAMInAWGN and Figure ø:ref fig:serberMatchedFilterSimulationOfPAMInAWGN in terms of BER.4.16 Results increasing the oversample to L = 20, which corresponds to SNR
MF ≈SNR
in + 13dB.4.3Symbol − basedsimulationofmatchedfiltering.
4.3.8 Proof sketch of the optimality of matched filtering for AWGN
4.4 Receivers to Combat ISI and Their Analysis
4.4.1 Intersymbol interference (ISI)
4.4.2 Pulse response
4.4.3 Examples of intersymbol interference (ISI) in PAM
4.17 Example of achieving zero ISI by using a pulse p(t) shorter than the symbol duration Tsym. Figure ø:ref fig:isiExample1b is a zoomed version of the middle graphic in Figure ø:ref fig:isiExample1a.4.18 Example of achieving zero ISI by using a Nyquist pulse p(t).4.19 Example for which the ISI is non-zero because p(t) is not a Nyquist pulse.
4.4.4 Some practical aspects concerning the “pulse” to study ISI
4.4.5 Nyquist Criterion for Zero ISI
Zero ISI with a continuous-time model
4.20 Explanation of the Nyquist criterion: the replicas of P(f) for k = 0 and 1 in Eq. (ø:ref eq:nyquistCondition) cannot have a gap between them.4.21 Spectrum of Ps(f) corresponding to a p(t) with a triangular spectrum P(f) of BW = 200 Hz and Rsym = 500 bauds.
Zero ISI with a discrete-time model
4.22 Spectra for the pulse p=[1 1 1 1].4.4 MatlabOctaveCodeSnippets/snip_digi_comm_ak_plotNyquistPulse.m4.23 Assuming the transmitted symbols are symbols=[3 -1 3 1], p=[1 1 1 1] and L = 4, from top to bottom: p[n], the shifted and scaled versions of p[n] corresponding to each symbol and the transmitted signal s[n].4.24 Equivalent to Figure ø:ref fig:pulse1_spectrum with the pulse p=[0 -1 2 1 1 -2 0].4.25 Equivalent to Figure ø:ref fig:pulse1_timedomain with the pulse p=[0 -1 2 1 1 -2 0].4.5 MatlabOctaveCodeSnippets/snip_digi_comm_ak_plotNyquistPulse2.m
4.4.6 Cursor, precursor ISI and postcursor ISI
4.26 Two examples of channel pulse responses p(t): the second one, (b), potentially leads to stronger ISI due to its more dispersive channel than (a).4.27 Pulse response of Figure ø:ref fig:isi_pulse_response(b) with the timing reference provided by the estimated cursor at tc.4.28 Illustration of ISI at cursor tc corresponding to the symbol transmitted at t = 2Tsym.
4.5 Raised Cosine Shaping Pulses (Filters)
4.29 Raised cosines with Rsym = 1000 bauds and roll-off r = 0,0.5 and 1.4.30 Equivalent to Figure ø:ref fig:pulse1_spectrum with a raised cosine pulse with r = 0.5.4.31 Equivalent to Figure ø:ref fig:pulse1_timedomain with a raised cosine pulse with r = 0.5.4.6 MatlabOctaveCodeSnippets/snip_digi_comm_rcosine_timedomain.m4.32 Comparison of raised cosine filters with r = 1,L = 3 and different orders.
4.6 Matched Filtering and the Square-Root Raised Cosine
4.7 Eye Diagrams
4.7MatlabOctaveBookExamples/ex_eye_diagram.m4.33 a) Signals corresponding to the b) eye diagram obtained with a 4-PAM shaped with a square pulse of non-zero samples and oversampling L = 3.4.34 Eye diagram obtained with a 4-PAM shaped with a raised cosine with roll off r = 1.4.35 Eye diagram obtained with a 4-PAM shaped with a raised cosine with roll off r = 0.4.36 Eye diagrams for 2-PAM (symbols ± 1) using raised cosines with r = 0 and r = 1 under AWGN with SNR = 15 dB or noise-free transmission.4.37 Eye diagram obtained for an 2-PAM signal transmitted using 2.5 Gbauds over an optical link.4.38 Eye diagram obtained for an 4-PAM signal transmitted using 12.5 Gbauds over an optical link.
4.8 Distinguishing Nyquist Criterion and Sampling Theorem
4.2 Contrasting the Nyquist criterion for zero ISI and the sampling theorem for real-valued signals.4.3 Contrasting the Nyquist criterion for zero ISI and the sampling theorem for analytic complex-valued signals.
4.9 Equalization and System Identification
4.9.1 System identification using least squares (LS)
4.8MatlabOctaveCodeSnippets/snip_systems_channel_estimation.m
Synchronization together with channel estimation
4.39 Autocorrelation Rx[k] (left plot) of a M-sequence @@x with 2m − 1 samples, m = 5. The corresponding XHX gets closer to an identity matrix as Rx[k] gets closer to an impulse.4.9 MatlabOctaveCodeSnippets/snip_systems_Msequence_chan_est.m4.10MatlabOctaveBookExamples/ex_systems_LS_channel_estimation.m4.40 Comparison between least-squares estimations using methods 1, 2 and 3 from Listing ø:ref code:ex_systems_LS_channel_estimation.4.41 Same as Figure ø:ref fig:ls_channel_estimation but with training sequence increased from 63 to 2047 samples.4.42 Same as Figure ø:ref fig:ls_channel_estimation but with SNR increasing from 20 dB to infinite.
4.9.2 Zero-forcing (ZF) equalization criterion
4.11MatlabOctaveCodeSnippets/snip_digi_comm_min_phase_channel.m4.12MatlabOctaveCodeSnippets/snip_digi_comm_not_min_phase_chan.m
4.9.3 Least squares FIR equalizer based on estimated channel
4.13MatlabOctaveCodeSnippets/snip_channel_ls_equalizer.m
4.9.4 FIR equalizer: LS direct estimation with training sequence
4.14MatlabOctaveCodeSnippets/snip_channel_ls_equalizer_direct.m
4.9.5 Probabilistic approach to LS FIR system identification
4.10 Channel Capacity
4.10.1 Capacity of AWGN channels
4.10.2 Water filling
4.43 Frequency-selective channel modeled as a set of parallel “subchannels” and corresponding water filling solution.
Water filling for a finite set of parallel channels
4.44 Total rate for different allocations of power among K = 2 tones with channel squared magnitudes g0 = 0.1 and g1 = 10−10.
Watefilling solution via Lagrange multiplier
4.15MatlabOctaveFunctions/ak_simplewaterfill.m4.16MatlabOctaveCodeSnippets/snip_channel_waterfilling.m4.45 Watterfilling example with K = 7 tones, in which there was no power allocated to the fourth and fifth tones.
Water filling for continuous frequency
4.10.3 Capacity of the frequency-selective LTI Gaussian channel
4.10.4 Revisiting the capacity of flat fading continuous-time AWGN
4.11 Synchronization
4.11.1 Carrier recovery
4.11.2 Carrier recovery using FFT
PAM carrier recovery using FFT
4.17MatlabOctaveCodeSnippets/snip_channel_pam_squared_freqs.m4.18MatlabOctaveCodeSnippets/snip_channel_pam_sync_if.m4.19./Code/MatlabOctaveBookExamples/ex_fftBasedPAMCarrierRecovery4.46 PSD of baseband PAM signal with bandwidth of approximately 8 MHz.4.47 PSD of frequency-upconverted PAM signal to carrier frequency of 1 GHz.4.48 PSDs of PAM frequency-downconverted to IF.4.49 PSD of the squared received signal r used for the estimation of the offsets4.50 Values of the squared received signal FFT within the range of interest.4.51 PSDs of the received signal r and its version after multiplication by the complex exponential e−j(ωΔ+ϕ).4.52 Received signal after carrier recovery.4.53 Transmit and receive symbol constellations.
QAM carrier recovery using FFT
4.4 Signals associated to Θk(t),k = 1,…,12.4.54 PSD of r4(t), obtained via Eq. (ø:ref eq:qamToTheFourth).4.55 Zooms of the PSD in Figure ø:ref fig:qamOffsetsTo4Rx in four regions.4.56 Transmit and received QAM constellations after correction of the offsets.4.57 Top: Relation between Φ (fftPeakPhase) versus the phase offset ϕ. Bottom: Estimation error.4.20 ./Code/MatlabOctaveBookExamples/ex_fftBasedQAMCarrierRecovery
4.11.3 Phase-locked loop (PLL)
4.11.4 Continuous-time PLL for tracking sinusoids
4.58 Block diagram of a basic continuous-time phase-locked loop (PLL).
VCO
Phase detector
Loop filter
A linear model for the continuous-time PLL in the phase domain
4.59 A linear model for the continuous-time PLL in phase-domain using Laplace transforms.4.60 PLL step responses for several values of ζ.4.61 PLL step responses for several values of ζ.4.62 PLL phase error when the input is a ramp.
4.11.5 Discrete-time PLL (DPLL) for tracking sinusoids
4.63 Block diagram of a basic discrete-time phase-locked loop (DPLL).
A linear model for the discrete-time PLL in the phase domain
4.64 A linear model for the discrete-time PLL in phase-domain using Z transforms.4.65 Loop filter L(z) of Eq. (ø:ref eq:pllLzSecondOrder) for a second-order PLL.4.66 Second-order PLL model when L(z) is given by Eq. (ø:ref eq:pllLzSecondOrder).
4.11.6 Design of PLL and DPLL
Design of continuous-time PLL
Design of discrete-time PLL
4.11.7 Discrete-time PLL (DPLL) for tracking digitally modulated... decision directed...
4.12 Channel Model with Frequency Offset
4.13 Applications
4.21MatlabOctaveCodeSnippets/snip_digi_comm_raised_cosine_pulse.m4.22Python_Language/raisedCosine.py4.23MatlabOctaveCodeSnippets/snip_digi_comm_raised_cosine_GR.m4.24MatlabOctaveFunctions/ak_generateZeroISIPulses.m4.25MatlabOctaveCodeSnippets/snip_digi_comm_ak_calculateISI.m4.26MatlabBookFigures/figs_digi_comm_awgn_decomposition4.67 Comparison of autocorrelations for the signals at the outputs of the D = 2 correlators at Fs (top) and Rsym (bottom) rates.4.68 Histogram of vectors [@@N1;@@N2] from rxSymbols in Listing ø:ref code:figs_digi_comm_awgn_decomposition.4.69 Frequency domain interpretation of Figure ø:ref fig:wgnExpansion using the first basis function: the filter gain (top), PSDs of output signal at rate Fs and Rsym (bottom).4.27 ./Applications/GSMsim/ak_GSMsim/examples/ak_GSMsim_demo.m4.70 PSDs of original and filtered signals. Note that the PSDs do not present Hermitian symmetry because the original and filtered signals are complex-valued.4.71 Generated by Listing ø:ref code:ex_gsm_freq_correction: a) is the FB burst, b) is the received constellation when there is a frequency offset of 0.1 rad and c) is the corrected constellation.4.28 ../Applications/GSM_PHY_Analysis/ex_gsm_freq_correction4.72 Location of a burst for frequency correction. All graphs are in degrees, not rad. The top plot a) shows the phase p[n] of received symbols, b) is the difference p[n] − p[n − 1] with a line indicating a difference of − 90 and c) indicates the estimated start sample.4.73 Angle differences for the detected frequency correction burst, where the indicated average is the frequency offset of 0.2017 radians.4.74 Result of search for SCH.4.29 Applications/GSM_PHY_Analysis/find_sch.m4.30MatlabOctaveBookExamples/ex_crossCorrelationDiffRates.m
4.14 Comments and Further Reading
4.15 Exercises
5 Optimal Receivers and Probability of Error for AWGN
5.1 What You Will Learn
5.1 Received symbols of 4-PAM simulation at SNR of 10 dB, Pe = 0.13 and Pb = 0.08.
5.1.1 Probability distribution of received signal at AWGN output
5.2 PDFs of the noise @@N with zero mean and variance σ2 = 0.5 and received symbol @@R = m + @@N when symbol m = −3 is transmitted.
5.1.2 Using symbol-based simulations for AWGN
5.1MatlabOctaveCodeSnippets/snip_digi_comm_SER_simulation.m
5.2 Detection Theory and Probability of Error for AWGN Channels
5.3 Voronoi regions for a constellation with M = 6 hypothetical symbols.5.4 Conditional probabilities p(r|m = −3) = U(−5,0) and p(r|m = 1) = U(−1,2) for a binary transmission with symbols m ∈{−3,1}.5.2 Brute-force method for finding optimal decision regions.5.5 Conditional probabilities p(r|m) for a 4-PAM with symbols m ∈{−3,−1,1,3} assuming a Gaussian noise with variance σ2 = 2.
5.3 MAP and ML Receivers for Symbol-by-Symbol Decisions
5.6 Conditional probabilities p(r|m) and MAP thresholds. In case a) the priors are uniform but the variances of the noises added to each symbol differ while in b) the variances are the same (as in AWGN) but the priors differ.5.7 Posteriori distributions p(m|r) for the examples in Figure ø:ref fig:regionsForMAP.
5.4 MAP and ML Receivers for Symbol Sequences in Dispersive Channels
5.5 Estimating Probability of Error for PAM
5.5.1 The union bound
5.6 Estimating Probability of Error for QAM
5.1 Expressions for PAM and SQ QAM, where the M-QAM is obtained by the Cartesian product of two M-PAM constellations.5.8 QAM cross constellations for b = 3,5,7 and 9, from a) to d), respectively.
5.6.1 Estimating probability of error for PSK
5.9 Examples of PSK constellations for b = 2,3,4 and 5 bits per symbol in a) to d), respectively.
5.6.2 Statistical validity of error probability estimations
5.10 Comparison of simulated and theoretical BER for binary PAM (the result for BPSK is equivalent).5.3 MatlabOctaveBookExamples/ex_pam_ber.m
5.7 Comparing modulation schemes
5.11 Comparison of Pe obtained with three PAM systems as a function of d∕(2σ).5.12 Comparison of Pe obtained with three PAM systems as a function of the SNR (in dB) for the corresponding values of d∕(2σ) in Figure ø:ref fig:pe_severalPAM.5.13 Comparison of simulated and theoretical BER for binary PAM or BPSK using Eb∕N0. It should be compared to Figure ø:ref fig:binaryPAM_ber.5.4 MatlabOctaveBookExamples/ex_pam_ber_ebn0.m5.5MatlabOctaveBookExamples/ex_qam_ber.m5.6MatlabOctaveBookExamples/ex_qam_ber_ebn0.m5.14 Comparison of M-QAM, M-PSK and the Shannon limit.5.7 MatlabOctaveCodeSnippets/snip_digi_comm_modulation_compare.m5.15 An alternative comparison of M-QAM, M-PSK and the Shannon limit, which contains the same information as Figure ø:ref fig:modulation_comparison.
5.8 The Gap Approximation
5.8.1 The PAM 6-dB rule: each extra bit requires 6 dB
5.16 a) Graph of Eq. (ø:ref eq:pambits) for σ2 = 2 and d = 1. b) Corresponding Pe.5.17 Comparison between the symbol error probability Pe and the estimate P^e using the gap approximation for PAM with SNR = 10 dB.5.18 Comparison between the symbol error probability Pe and the estimate P^e using the gap approximation for PAM with SNR = 30 dB.
5.8.2 The QAM 3-dB rule: each extra bit requires 3 dB
5.8MatlabOctaveCodeSnippets/snip_digi_comm_pam_qam_gaps.m5.2 Gaps in linear and dB scales for PAM and square QAM for a symbol error rate Pe.5.19 QAM gap approximation for SNR = 10 dB: comparing the error with respect to the number of bits.5.20 QAM gap approximation for SNR = 5 dB: comparing the error with respect to the number of bits.
5.9 Comments and Further Reading
5.10 Review Exercises
5.11 Exercises
5.21 Signals of a 4-ary digital communication system.
6 Multicarrier systems
6.1 What You Will Learn
6.2 DMT and OFDM Multicarrier Modulations
6.3 DMT Modulation via Matlab/Octave Code
6.1 DMT block diagram.6.1 MatlabOctaveBookExamples/ex_dmt_one_symbol.m6.2MatlabOctaveBookExamples/ex_dmt_two_symbols.m6.3MatlabOctaveBookExamples/ex_dmt.m
6.4 DMT/OFDM rate estimation
6.5 DMT / OFDM in Matrix Notation
6.4MatlabOctaveCodeSnippets/snip_multicarrier_DMTInMatrixNotation.m
6.6 Total Transmit Power Estimation
6.5MatlabOctaveBookExamples/ex_multicarrier_parseval.m6.6MatlabOctaveCodeSnippets/snip_multicarrier_power_calculation.m
6.7 Operation modes: RA, MA and PA (FM)
6.8 Applications
6.1 Parameters for DSL standards. The values of Lcp and Rdmt are detailed in Table ø:ref tab:cp. TBD stands for “to be defined”. 6.2 Allowed range for m in G.fast (Fs = 211.968 MHz) and corresponding parameters assuming BW = 100 MHz.6.7 MatlabOctaveBookExamples/ex_svd_partitioning.m6.8MatlabOctaveBookExamples/ex_snr_in_svd_partitioning.m6.9MatlabOctaveBookExamples/ex_dft_eigendecomposition.m6.10MatlabOctaveBookExamples/ex_dft_partitioning.m
6.9 Comments and Further Reading
6.10 Exercises
A Useful Mathematics
A.1 Euler’s Equation
A.2 Trigonometry
A.3 Manipulating Complex Numbers and Rational Functions
A.4 Manipulating Complex Exponentials
A.5 Geometric Series
A.6 Sum of Squares
A.7 Summations and Integrals
A.8 Partial Fraction Decomposition
A.9 Calculus
A.10 Sinc Function
A.11 Rectangular Integration Defining Normalization Factors
A.11.1 Two normalizations for the histogram
A.11.2 Two normalizations for power distribution using FFT
A.1 Analogy between using the histogram and DFT for estimation, where ĝ(x[n]) is the estimated function and f^(x[n]) = κĝ(x[n]) its normalized version. The unit of f^(x[n]) is indicated within parentheses.
A.12 Linear Algebra
A.12.1 Inner products and norms
A.12.2 Projection of a vector using inner product
A.1 The perpendicular line for obtaining the projection pxy of a vector x onto y in ℝ2.A.2 Projections of a vector x and y onto each other.A.1 MatlabOctaveCodeSnippets/snip_transforms_projection.m
A.12.3 Orthogonal basis allows inner products to transform signals
A.2MatlabOctaveCodeSnippets/snip_transforms_non_orthogonal_basis.m
A.12.4 Moore-Penrose pseudoinverse
A.3MatlabOctaveCodeSnippets/snip_systems_pseudo_inverse.m
A.13 Gram-Schmidt orthonormalization procedure
A.4MatlabOctaveFunctions/ak_gram_schmidt.m
A.14 Principal component analysis (PCA)
A.5MatlabOctaveFunctions/ak_pcamtx.mA.3 Scatter plot of the input data and the basis functions obtained via PCA and Gram-Schmidt orthonormalization.A.4 Scatter plots of two-dimensional Gaussian vector x (represented by x) and PCA transformed vectors y (represented by +)A.5 Scatter plots of two-dimensional Gaussian vector x (x) and Gram-Schmidt transformed vectors y (+).
A.15 Fourier Analysis: Properties
A.16 Fourier Analysis: Pairs
A.17 Probability and Stochastic Processes
A.18 Probability
A.18.1 Joint and conditional probability
A.18.2 Random variables
A.6 PMF for a dice result.A.7 Obtaining probability from a pdf (density function) requires integrating over a range.
A.18.3 Expected value
A.18.4 Orthogonal versus uncorrelated
A.18.5 PDF of a sum of two independent random variables
A.19 Stochastic Processes
A.8 Example of a finite-duration random signal.A.9 Example of five realizations of a discrete-time random process.A.10 Example of evaluating a random process at time instants n = 4 and n = 6, which correspond to the values of two random variables X[4] and X[6].A.11 Example of a joint pdf of the continuous random variables X[4] and X[6].
Correlation Function and Matrix
A.6MatlabOctaveFunctions/ak_correlationEnsemble.mA.12 Correlation for data in matrix victories.A.13 Version of Figure ø:ref fig:correlationNonStationary using an image.
Two time instants: both absolute or one absolute and a relative (lag)
A.14 Comparison between the 3-d representation of the autocorrelation matrix in Figure ø:ref fig:correlationNonStationary and the one using lags as in Eq. (ø:ref eq:discreteTimeCorrelation).A.15 Comparison between autocorrelation representations using images instead of 3-d graphs as in Figure ø:ref fig:twoAbsVersusLag.
Covariance matrix
Stationarity, cyclostationarity and ergodicity
A.16 Representation of a WSS autocorrelation matrix that depends only on the lag l.A.17 Suggested taxonomy of random processes.A.18 Correlation for random sequences with two equiprobable values:A.19 Alternative representation of the correlation values for the polar case of Figure ø:ref fig:correlationStationary.A.7 MatlabOctaveFunctions/ak_convertToWSSCorrelation.mA.20 One-dimensional ACF RX[l] for the data corresponding to Figure ø:ref fig:correlationStationary (unipolar and polar codes).A.21 ACF estimated using ergodicity and waveforms with 1,000 samples for each process.
A.19.1 Proper and circular complex-valued random variables
A.19.2 Rotationally symmetric signal constellations
A.19.3 Cyclostationary random processes
A.22 Functions used to characterize cyclostationary processes.A.8 MatlabOctaveCodeSnippets/snip_appprobability_modulatednoise.mA.23 Single realization x[n] of Eq. (ø:ref eq:modulatedWGN) (top) and the ensemble variance over time (bottom plot), which has a period of P∕2 = 15 samples.A.24 Cyclostationary analysis of the modulated white Gaussian noise.A.9 MatlabOctaveCodeSnippets/snip_appprobability_cyclo_analysis_ensemble.mA.10MatlabOctaveCodeSnippets/snip_appprobability_cyclo_analysis.mA.11MatlabOctaveCodeSnippets/snip_appprobability_cyclo_spectrum_periodograms
A.19.4 Two examples of cyclostationary signals
A.25 Realizations of polar signal mu[n] after upsampling by L = 4 samples.A.26 Autocorrelation of the cyclostationary mu[n] polar signal upsampled by L = 4.A.12 MatlabOctaveCodeSnippets/snip_digi_comm_upsampled_autocorrelation.mA.27 Autocorrelation of the cyclostationary mu[n] unipolar signal obtained with upsampling by L = 4.
A.19.5 Converting a WSC into WSS by randomizing the phase
A.28 Realizations of an upsampled polar signal (L = 4) with random initial sample.A.29 ACF for the same polar process that generated the realizations in Figure ø:ref fig:cyclostationaryRealizations.A.30 Three realizations of the random process corresponding to upsampling by 2 and randomly shifting a sinusoid of period N = 4 and amplitude A = 4.A.31 Correlation of the WSS process corresponding to Figure ø:ref fig:realizationsUpShiftedSine.A.13 MatlabOctaveCodeSnippets/snip_app_correlationEnsemble.mA.32 Autocorrelation matrices for the a) WSS process obtained by phase randomization of the b) WSC process.
A.20 Estimation Theory
A.20.1 Probabilistic estimation theory
A.20.2 Minimum mean square error (MMSE) estimators
A.21 One-dimensional Linear Prediction Over Time
A.21.1 The innovations process
Linear prediction for signal decorrelation
A.21.2 Autoregressive (AR) linear prediction
A.14MatlabOnly/snip_appprediction_example.m
A.22 Advanced: Vector Prediction Exploring Spatial Correlation
A.15MatlabOctaveCodeSnippets/snip_appprediction_spatialLinearPredictionExample.m
A.23 Spatial Whitening Applied to Interference Mitigation
A.24 Space-Time Prediction
A.25 Non-linear Decorrelation
A.26 Noise Prediction and DFE
A.27 Decibel (dB) and Related Definitions
A.28 Insertion Loss and Insertion Frequency Response
A.33 Basic setup for measuring the insertion loss of a device under test (DUT).
A.29 Discrete and Continuous-Time Impulses
A.29.1 Discrete-time impulse function
A.29.2 Why defining the continuous-time impulse? Some motivation
A.34 PDF for a dice roll result when the random variable is assumed to be continuous.
A.29.3 Definition of the continuous-time impulse as a limit
A.29.4 Continuous-time impulse is a distribution, not a function
A.29.5 Mathematical properties of the continuous-time impulse
Sifting property
Scaling property
A.29.6 Convolution with an impulse
A.29.7 Applications of the impulse
A.30 System Properties
A.30.1 Linearity (additivity and homogeneity)
A.35 A 3-d representation of the system H(z) = 3 − 2z−1.
A.30.2 Time-invariance (or shift-invariance)
A.30.3 Memory
A.30.4 Causality
A.30.5 Invertibility
A.30.6 Stability
A.30.7 Properties of linear and time-invariant (LTI) systems
A.31 Fixed and Floating-Point Number Representations
A.16MatlabOctaveCodeSnippets/snip_signals_data_precision.mA.36 Comparison of step sizes for IEEE 754 floating points with single and double precisionA.17 MatlabOctaveCodeSnippets/snip_signals_delta_calculation.mA.18MatlabOctaveCodeSnippets/snip_signals_numerical_error.mA.19MatlabOctaveCodeSnippets/snip_signals_single_precision.m
B Useful Softwares and Programming Tricks
B.1 The GNU Radio (GR) Project
B.1.1 For those willing to stop reading and run code
B.1 GNU Radio Companion interface highlighting the icons to execute the simulation.
B.1.2 Basic facts about GR
B.2 GR-Based SDR Hardware (USRP, RTL-SDR Dongle, etc.)
B.1 Examples of SDR Hardware Platforms.
B.2.1 Universal Software Radio Peripheral (USRP)
B.2 USRP block diagram.
B.3 Using GNU Radio and USRP
B.3 Block diagram describing a wireless system using GMSK. The blocks correspond to objects in Python that interface with GNU Radio code in C++ language.B.4 Experimental setup using two USRPs for getting familiar with GNU Radio.
B.4 Matlab and Octave
B.4.1 Octave Installation
B.5 Manipulating signals stored in files
B.5.1 Hex / Binary File Editors
B.5 Screenshot of the FileViewer software.
B.5.2 ASCII Text Files: Unix/Linux versus Windows
B.6 Screenshot of the FileViewer dialog window that allows to convert between Linux and Windows text files.B.7 Screenshot of the FileViewer software showing the result of converting the Windows file of Figure ø:ref fig:fileviewer_screen1 to the Linux format.
B.5.3 Binary Files: Big versus Little-endian
B.8 Interpretation of the file in Figure ø:ref fig:fileviewer_screen2 as short (2-bytes) big-endian elements.
B.5.4 Some Useful Code to Manipulate Files
Matlab/Octave language
C language
Java language
B.1Java_Language/FileManipulation.java
B.5.5 Interpreting binary files with complex headers
B.9 Contents in hexadecimal of file floatsamples.bin generated with Listing ø:ref code:FileManipulation.java.B.10 Interpretation as big-endian floats of file floatsamples.bin generated with Listing ø:ref code:FileManipulation.java.B.11 Contents interpreted as floats of big-endian file htk_file.bin generated with HTK.
C Analog and Digital Signals
C.1 What You Will Learn
C.2 Analog, Digital and Discrete-Time Signals
C.1 Notation used for continuous and discrete-time signals. C.1 Example of analog signal. Note the abscissa is continuous and the amplitude is not quantized, assuming an infinite number of possible values.C.2 Example of digital signal obtained by digitalizing the analog signal in Figure ø:ref fig:analogsignal
C.2.1 Advanced: Ambiguous notation: whole signal or single sample
C.2.2 Digitizing signals
C.2.3 Discrete-time signals
C.3 Example of discrete-time signalC.1 MatlabOctaveCodeSnippets/snip_signals_signal_generation.m. [ Python version]C.4 Example of a discrete-time cosine generated with Listing ø:ref code:snip_signals_signal_generation.
C.3 Basic Signal Manipulation and Representation
C.3.1 Manipulating the independent variable
C.2 New signals y1[n] = x[n − 2], y2[n] = x[−n + 3], y3[n] = x[2n] and y4[n] = x[n2], obtained by manipulating x[n] = n2(u[n − 3] − u[n − 7]). C.2 MatlabOctaveCodeSnippets/snip_signals_timereversal.m. [ Python version]C.5 Representation of signals related by y[n] = x[−n].
C.3.2 When the independent variable is not an integer
C.3.3 Frequently used manipulations of the independent variable
C.6 Examples of manipulating the independent variable: time-shift, contraction and dilation.C.7 Three examples of simultaneously scaling and shifting a signal x(t).C.8 Examples of manipulating the independent variable (in this case x) of a sinc function.C.3 MatlabOctaveCodeSnippets/snip_signals_sinc.m. [ Python version]C.9 Graph of a continuous-time sinc function centered at t = 0.5 s, obtained with Listing ø:ref code:snip_signals_sinc.
C.3.4 Using impulses to represent signals
C.3.5 Using step functions to help representing signals
C.3.6 The rect function
C.4MatlabOctaveCodeSnippets/snip_signals_rect.m. [ Python version]C.10 Graphs of continuous and discrete-time signals obtained with the rect function in Listing ø:ref code:snip_signals_rect.C.5 MatlabOctaveCodeSnippets/snip_signals_three_rects.m. [ Python version]C.11 Graph of the signal described in Eq. (ø:ref eq:three_rects).
C.4 Block or Window Processing
C.4.1 Block processing without overlapping
C.6MatlabOctaveCodeSnippets/snip_transforms_segmentation.m. [ Python version]
C.4.2 Advanced: Block processing with overlapped windows
C.12 The top representation shows non-overlapping windows of L = 4 samples, with both non-windowed indexing x[n] and windowed indexing x[k,m]. The bottom representation shows overlapping windows with L = 4 and shift S = 1 sample using non-windowed indexing.C.13 Interpreting Eq. (ø:ref eq:num_of_windows) to obtain M = 3 windows of L = 5 samples from a total of N = 13 samples using a shift of S = 3 samples.
C.5 Advanced: Complex-Valued and Sampled Signals
C.5.1 Complex-valued signals
C.5.2 Sampled signals
C.14 Signals classification including the sampled signals.C.15 Example of sampled signal
C.6 Signal Categorization
C.6.1 Even and odd signals
C.16 Even and odd components of a signal x[n] representing a finite-duration segment of the step function u[n]. Note the symmetry properties: xe[n] = xe[−n] and xo[n] = −xo[−n].C.17 Even and odd components of a signal x[n] = n2u[n] representing a parabolic function.C.18 Even and odd components of a signal x[n] representing a triangle that starts at n = 21 and has its peak with an amplitude x[60] = 40 at n = 60. Note that the peak amplitude of the two components is 20.
C.6.2 Random signals and their generation
C.19 Waveform representation of a random signal with 100 samples draw from a Gaussian distribution N(0,1).C.20 Histogram of the signal in Figure ø:ref fig:zeromean_randomsignal with 10 bins.C.21 Example of histogram with B = 3 bins. The centers are 1.5, 2.5 and 3.5, all marked with ’×’. The bin edges are 1,2,3 and 4.C.7 MatlabOctaveCodeSnippets/snip_signals_estimate_pdf.m. [ Python version]C.22 PDF estimate from the histogram in Figure ø:ref fig:simple_histogramC.8 MatlabOctaveCodeSnippets/snip_signals_gaussian_rand_gen.m. [ Python version]C.23 Comparison of normalized histogram and the correct Gaussian N(4,0.09) when using 10,000 samples and 100 bins
C.6.3 Periodic and aperiodic signals
Periodicity in continuous-time
Periodicity of a generic discrete-time signal
Periodicity of discrete-time sinusoids
C.24 Graph of the signal x[n] = sin (0.2n).C.25 Graph of the signal x[n] = sin ((3π∕17)n).
C.6.4 Power and energy signals
C.3 Total energy E and average power P for two kinds of signal assuming an infinite time interval.
C.7 Modeling the Stages in A/D and D/A Processes
C.7.1 Modeling the sampling stage in A/D
C.26 An impulse train with unitary areas and Ts = 125 μs.C.27 Example of a sampled signal obtained with a sampling frequency smaller than the required for accurately representing the original signal (shown in dotted lines).
C.7.2 Oversampling
C.9MatlabOctaveCodeSnippets/snip_signals_oversampling.m. [ Python version]C.28 Example of discrete-time cosines generated with sampling intervals of 125 μs (top) and 625 ns (bottom) to illustrate the better representation achieved by using a smaller sampling interval Ts, which corresponds to adopting a larger oversampling factor.
C.7.3 Mathematically modeling the whole A/D process
C.29 Complete process of A/D conversion with intermediate stages and four signals: analog, sampled, discrete-time and digital.
C.7.4 Sampled to discrete-time (S/D) conversion
C.30 Example of S/D conversion assuming Ts = 0.2 s.
C.7.5 Continuous-time to discrete-time (C/D) conversion
C.7.6 Discrete-time to sampled (D/S) conversion
C.31 Example of D/S conversion assuming Ts = 0.2 s. It implements the inverse operation of Figure ø:ref fig:sd_conversion.
C.7.7 Reconstruction
Reconstruction with zero-order holder (ZOH)
C.32 Example of ZOH reconstruction using the signals of Example ø:ref ex:sd_conversion with Ts = 0.2 s. In this case, x[n] = 0.5δ[n] − 2.8δ[n− 1] + 1.3δ[n− 2] + 3.5δ[n− 3] − 1.7δ[n− 4] + 1.1δ[n− 5]) + 4δ[n− 6].
Reconstruction with sincs
C.33 Example of D/A of signal xq[n] = δ[n] − 3δ[n − 1] + 3δ[n − 2] (with quantized amplitudes) with D/S using Ts = 0.2 s and reconstruction using sinc functions.C.34 Identification of the individual scaled sinc functions (dashed lines) after D/S with Ts = 0.2 s and signal reconstruction of xq[n] = δ[n] − 3δ[n − 1] + 3δ[n − 2] in Figure ø:ref fig:sinc_reconstruction.
C.7.8 Discrete-time to continuous-time (D/C) conversion
C.7.9 Analog to digital (A/D) and digital to analog (D/A) conversions
C.35 Signal reconstruction of a signal with quantized amplitudes using ZOH.C.36 Complete processing chain of an input analog signal x(t) to generate an output y(t) using DSP.
C.7.10 Sampling theorem
C.10MatlabOctaveCodeSnippets/snip_signals_cosine_reconstruction.m. [ Python version]C.37 Sampling and sinc-based perfect reconstruction of a cosine as implemented in function ak_sinc_reconstruction.m.C.38 Single sinc parcel from Figure ø:ref fig:cosine_reconstruction_parcels corresponding to the sinc centered at t = −0.8 s as dashed line and the reconstructed signal as a solid line.C.39 All individual parcels in dashed lines corresponding to each sinc and the summation as reconstructed signal (solid line) of Listing ø:ref code:snip_signals_cosine_reconstruction.C.11 MatlabOctaveCodeSnippets/snip_signals_reconstruction_sinc.m. [ Python version]C.40 Sampling and reconstruction of x(t) = sinc(t∕0.2) − 3sinc((t − 0.2)∕0.2) + 3sinc((t − 0.4)∕0.2) using Ts = 0.1 s.C.41 Sinc parcels used in the reconstruction of x(t) of Figure ø:ref fig:sinc_reconstruction_steps.C.42 Example of failing to reconstruct the signal x(t) = cos (2π2.5t − 0.5π) using Fs = 2fmax = 5 Hz.C.12 MatlabOctaveCodeSnippets/snip_signals_sampling_inequality.m. [ Python version]C.13MatlabOctaveCodeSnippets/snip_signals_reconstruction_failure.m. [ Python version]C.43 Reconstruction of signal given by Eq. (ø:ref eq:three_rects) fails because the sampling theorem is not obeyed.C.44 Sinc parcels used in the signal reconstructed as depicted in Figure ø:ref fig:failed_reconstruction_steps.C.4 Typical sampling frequencies.
C.7.11 Advanced: Different notations for S/D conversion
C.8 Relating Frequencies of Continuous and Discrete-Time Signals
C.8.1 Units of continuous-time and discrete-time angular frequencies
C.8.2 Mapping frequencies in continuous and discrete-time domains
C.14MatlabOctaveCodeSnippets/snip_signals_sinusoid_generation.m. [ Python version]
C.8.3 Nyquist frequency
C.8.4 Frequency normalization in Python and Matlab/Octave
C.5 The notation and values of the Nyquist frequency in distinct domains.C.45 Versions of the Nyquist frequency in continuous and discrete-time.
C.9 An Introduction to Quantization
C.9.1 Quantization definitions
C.46 Input/output mapping for the non-uniform quantizer specified by ℳ = {−4,−1,0,3}.C.6 Input/output mapping for the quantizer specified by ℳ = {−4,−1,0,3} of Figure ø:ref fig:nonuniform_quantization.
C.9.2 Implementation of a generic quantizer
C.15MatlabOctaveCodeSnippets/snip_signals_nonuniform_quantization.m. [ Python version]C.16MatlabOctaveCodeSnippets/snip_signals_nonuniform_quant2.m. [ Python version]
C.9.3 Uniform quantization
C.9.4 Granular and overload regions
C.47 Input/output relation of a 3-bits quantizer with Δ 1.C.48 Input/output relation of a 3-bits quantizer with Δ 0.5.
C.9.5 Design of uniform quantizers
Designing a uniform quantizer based on input’s statistics
Designing a uniform quantizer based on input’s dynamic range
C.17MatlabOctaveCodeSnippets/snip_signals_quantizer.m. [ Python version]C.18MatlabOctaveFunctions/ak_quantizer.mC.19MatlabOctaveCodeSnippets/snip_signals_quantizer_use.m. [ Python version]
C.9.6 Design of optimum non-uniform quantizers
C.7 Input/output mapping for a generic quantizer designed for a Gaussian input with variance σ2 = 10.C.49 Theoretical and estimated Gaussian probability density functions with thresholds represented by dashed lines and the output levels indicated with circles in the abscissa.C.50 Input/output mapping for the quantizer designed with a Gaussian input and outputs given by ℳ = [−6.8,−4.2,−2.4,−0.8,0.8,2.4,4.2,6.8].C.51 Results for the quantizer designed with the mixture of Eq. (ø:ref eq:mixture_of_gaussians) as input.
C.9.7 Quantization stages: classification and decoding
C.52 A quantizer Q is composed by the classification and decoding stages, denoted as Q~c and Q~d, respectively.
C.9.8 Binary numbering schemes for quantization decoding
C.8 Examples of binary numbering schemes used as output codes in A/D conversion for b = 3 bits.
C.9.9 Representing numbers in fixed-point
C.53 Fixed-point representation Q3.4 of the real number 5.0625. 1 Fixed-point conversion.2738
C.9.10 IEEE 754 floating-point standard
C.9.11 Quantization examples
C.54 Example of conversion using proportion when the dynamic ranges of both analog and digital signal are available
C.10 Correlation: Finding Trends
C.10.1 Autocorrelation function
C.9 Autocorrelation functions and their respective equation numbers.
Advanced: Definitions of autocorrelation for random signals
Definitions of autocorrelation for deterministic signals
C.10 Example of autocorrelation for a real signal [1,2,3] (n = 0,1,2). C.11 Example of calculating the unscaled autocorrelation for a complex-valued signal [1 + j,2,3] (n = 0,1,2), where j = −1. C.20MatlabOctaveCodeSnippets/snip_signals_unscaled_autocorrelation.m. [ Python version]
Examples of some signals autocorrelations
C.55 A sinusoid of period N=8 samples and its autocorrelation, which is also periodic each 8 lagsC.21 MatlabOctaveCodeSnippets/snip_signals_sinusoid_autocorrelation.m. [ Python version]C.56 The a) unbiased and b) raw (unscaled) autcorrelations for the sinusoid of Figure ø:ref fig:cosineAutocorrelation with a new period of N=15 samples.
C.10.2 Cross-correlation function
C.57 Sinusoid of amplitude 4 V immersed in AWGN of power 25 W. The bottom graph is a zoom showing the first 100 samples.C.58 Autocorrelations of sine plus noiseC.22 MatlabOctaveCodeSnippets/snip_signals_noisy_sinusoid.m. [ Python version]
Advanced: Random processes cross-correlation and properties
C.59 Continuous-time version of the AWGN channel model.
C.11 Advanced: A Linear Model for Quantization
C.12 Advanced: Power and Energy in Discrete-Time
C.12.1 Power and energy of discrete-time signals
C.12.2 Power and energy of signals represented as vectors
C.12.3 Advanced: Power and energy of vectors whose elements are not time-ordered
C.12.4 Power and energy of discrete-time random signals
C.12.5 Advanced: Relating power in continuous and discrete-time
C.13 Applications
C.60 Example of sound recorded at Fs = 44.1 kHz with the Audacity sound editor.C.61 Some Audacity options for saving an uncompressed WAVE file. The two non-linear PCMs are indicated.C.23 MatlabOctaveCodeSnippets/snip_signals_wavread.mC.24MatlabOnly/snip_signals_recordblocking.m. [ Python version]C.25MatlabOnly/snip_signals_wavwrite.mC.26MatlabOnly/snip_signals_realtimeLoopback.m. [ Python version]C.62 Cosine obtained with Listing ø:ref code:snip_signals_realtimeLoopback and a loopback cable connecting the soundboard DAC and ADC.C.27 MatlabOnly/snip_signals_digitize_signals.m. [ Python version]C.28MatlabOnly/snip_signals_realtimeWithDspSystem.m. [ Python version]C.63 Setup for loopback of the sound system using an audio cable.C.64 Example of options provided by Windows and the sound board. All the enhancements for both recording and playback devices should be disabled.C.29 MatlabOctaveCodeSnippets/snip_signals_impulse_train.m. [ Python version]C.65 Audacity window after reading in the ’impulses.wav’ file.C.66 Audacity window after simultaneously recording and playing ’impulses.wav’ with a loopback.C.67 Zoom of the response to the second impulse in Figure ø:ref fig:impulsesAudacity.C.30 MatlabOctaveCodeSnippets/snip_signals_amplitude_normalization.m. [ Python version]C.68 Scatter plot of customer age versus purchased units for three products.C.31 MatlabOctaveCodeSnippets/snip_signals_peak_detection.mC.69 Autocorrelation of the sunspot data.C.32 MatlabOctaveCodeSnippets/snip_signals_fundamental_frequency.m. [ Python version]C.70 Autocorrelation of a cosine of 300 HzC.33 MatlabOctaveCodeSnippets/snip_signals_cross_correlation.m. [ Python version]C.34MatlabOctaveCodeSnippets/snip_signals_time_delay.m. [ Python version]C.71 First graph shows signals x(t) and y(t − 0.25) contaminated by AWGN at a SNR of 10 dB.C.35 MatlabOctaveCodeSnippets/snip_signals_time_aligment.m. [ Python version]
C.14 Comments and Further Reading
D Transforms and Signal Representation
D.1 What You Will Learn
D.1 Examples of transforms and applications.
D.2 Linear Transform
D.2.1 Matrix multiplication corresponds to a linear transform
D.1 Rotation of a vector x by an angle 𝜃 = π∕2 radians using y = Ax with A given by Eq. (ø:ref eq:mat_rotation).
D.2.2 Basis: standard, orthogonal and orthonormal
D.3 Advanced: Inner Products to Obtain the Transform Coefficients
D.2 Examples of inner product definitions.
D.4 Block Transforms
D.4.1 Advanced: Unitary or orthonormal transforms
Observing that the inverse of a unitary real matrix is its transpose
D.4.2 DCT transform
D.1MatlabOctaveFunctions/ak_dctmtx.mD.2 The first three (k = 0,1,2) and the last (k = 31) basis functions for a 32-point DCT.
D.4.3 DFT transform
D.3 Angles Ω = 0,π∕2,π and 3π∕2 rad (or, equivalently, discrete-time angular frequencies) used by a DFT of N = 4 points when k varies from k = 0 to 3, respectively.D.4 Angles Ω = 0,2π∕5,4π∕5,6π∕5 and 8π∕5 rad (that in degrees corresponds to 0, 72∘, 144∘, −144∘, −72∘) used by a DFT of N = 5 points when k varies from k = 0 to 4, respectively.D.5 Mapping between angular frequencies Ω and the corresponding DFT coefficient X[k] for N = 6.D.6 Mapping between angular frequencies Ω and the corresponding DFT coefficient X[k] for N = 5.
On the symmetry of DFT coefficients when the input signal is real-valued
Advanced: DFT and FFT denoted with the twiddle factor WN
D.7 The angles corresponding to WN on the unit circle, for N = 3,4,5,6.D.8 Computational cost of the DFT calculated via matrix multiplication versus an FFT algorithm. Note that N = 4096 are used in standards such as VDSL2, for example, and it is clearly unreasonable to use matrix multiplication.
D.4.4 Haar transform
D.9 The first four (k = 0,1,2,3) and the last (k = 31) basis functions for a 32-point Haar.D.10 Basis functions k = 0,17 and the last four (k = 28,29,30,31) for a 32-point Haar.
D.4.5 Advanced: Properties of orthogonal and unitary transforms
Advanced: Unitary matrices lead to energy conservation
Advanced: Orthogonal but not unitary also allows easy inversion
D.5 Fourier Transforms and Series
D.3 The four pair of equations for Fourier analysis with eternal sinusoids and the description of their spectra: ck, X(f) (or X(ω)), X[k] and X(ejΩ. For periodic continuous and discrete-time signals the periods are T0 and N0, respectively, with fundamental (angular) frequencies ω0 = 2π∕T0 rad/s and Ω = 2π∕N0 rad. For continuous-time signals, one can alternatively use the linear frequency f instead of ω = 2πf, such that f0 = 1∕T0 is the fundamental frequency in Hz.D.4 Duality of periodicity and discreteness in Fourier analysis. D.5 Units for each pair of Fourier equations in Table ø:ref tab:fourier_equations.
D.5.1 Fourier series for continuous-time signals
Advanced: On the orthogonality of sinusoids
Fourier series using complex exponentials
D.11 Fourier series basis functions for analyzing signals with period T0 = 1∕50 seconds. Because the basis functions are complex-valued signals, the plots show their real (top) and imaginary (bottom) parts.D.12 Spectrum of x(t) = 4 + 10cos (2π50t + 2) + 4sin (2π150t − 1).
Trigonometric Fourier series
D.13 Unilateral spectrum of (real) signal x(t) = 4 + 10cos (2π50t + 2) + 4sin (2π150t − 1).
D.5.2 Discrete-time Fourier series (DTFS)
Calculating the DTFS via the DFT
D.14 DTFS / DFT of x[n] = 10cos (π 6 n + π∕3) calculated with N = 12.D.2 MatlabOctaveCodeSnippets/snip_transforms_DTFS.m. [ Python version]D.15 Complete representation of the DTFS / DFT of x[n] = 10cos (π 6 n + π∕3) indicating the periodicity X[k] = X[k + N].
D.5.3 Continuous-time Fourier transform using frequency in Hertz
D.5.4 Continuous-time Fourier transform using frequency in rad/s
D.16 Example of a Fourier transform X(f) and its equivalent representation X(ω) with ω in rad/s.D.17 Fourier transform of x(t) = 6cos (10πt) represented in Hertz and radians per second, indicating the scaling of the impulses areas by the factor 2π.
Units of the Fourier transform in linear and angular frequencies
D.5.5 Discrete-time Fourier transform (DTFT)
Calculating the DTFT via the DFT
D.18 Example of bins when using an N-point DFT with N = 4. The bin centers are 0,π∕2,π and 3π∕2, all marked with ’×’.
D.6 Relating spectra of digital and analog frequencies
D.19 Spectrum X(f) (top) and X(ejΩ when Fs = 60 Hz.
D.7 Advanced: Summary of equations for DFT / FFT Usage
D.6 Summary of equations useful for signal processing with FFT.
D.7.1 Advanced: Three normalization options for DFT / FFT pairs
D.8 Laplace Transform
D.8.1 Motivation to the Laplace transform
D.8.2 Advanced: Laplace transform basis functions
D.3MatlabOctaveCodeSnippets/snip_transforms_laplace_basis.m. [ Python version]D.20 Real part of e(−σ+j10π)t. The values of σ are − 0.3 and 0.3 for the first (left) and second graphs, respectively.
D.8.3 Laplace transform of one-sided exponentials
D.8.4 Region of convergence for a Laplace transform
D.8.5 Inverse Laplace of rational functions via partial fractions
D.21 Three poles (marked with ‘x’) and zero (marked with ‘o’) of Eq. (ø:ref eq:laplace_example).D.22 Magnitude (in dB) of X(s) = s−1 s3+4s2+9s+10 = s−1 (s+2)(s+1−j2)(s+1+j2) (Eq. (ø:ref eq:laplace_example)).D.23 Phase (in rad) of Eq. (ø:ref eq:laplace_example).
D.8.6 Calculating the Fourier transform from a Laplace transform
D.24 Graph of the magnitude (in dB) of X(s) = s−1 s3+4s2+9s+10 = s−1 (s+2)(s+1−j2)(s+1+j2) (Figure ø:ref fig:s_mag) with the identification of the corresponding values of the Fourier transform (magnitude).D.25 The values of the magnitude of the Fourier transform corresponding to Figure ø:ref fig:s_mag_and_jw.D.26 Two dimensional representation of Figure ø:ref fig:s_jw obtained with the command freqs in Matlab/Octave showing the peak at ω = 2 rad/s due to the respective pole.
D.9 Z Transform
D.9.1 Relation between Laplace and Z transforms
D.9.2 Advanced: Z transform basis functions
D.9.3 Some pairs and properties of the Z-transform
D.9.4 Region of convergence for a Z transform
D.9.5 Inverse Z of rational functions via partial fractions
Simplifying the partial fractions corresponding to complex conjugates
D.27 Magnitude (in dB) of X(z) = z+0.9 (z−0.8)(z−0.5−j0.6)(z−0.5+j0.6) (Eq. (ø:ref eq:example_z_transform)).D.28 Phase (in rad) of Eq. (ø:ref eq:example_z_transform).D.29 Pole / zero diagram for Eq. (ø:ref eq:example_z_transform).D.30 Graph of the magnitude (in dB) of X(z) = z+0.9 (z−0.8)(z−0.5−j0.6)(z−0.5+j0.6) (Figure ø:ref fig:z_mag) with the identification of the corresponding values of the DTFT (unit circle |z| = 1).D.31 The values of the magnitude of the DTFT corresponding to Figure ø:ref fig:z_mag_and_circle.
D.9.6 Calculating the DTFT from a Z transform
D.32 Magnitude (top) and phase (bottom) of the DTFT corresponding to Eq. (ø:ref eq:example_z_transform). These plots can be obtained with the Matlab/Octave command freqz and are a more convenient representation than, e. g., Figure ø:ref fig:z_circle.
D.10 Applications
D.33 Signal x[n] = δ[n − 11] analyzed by 32-point DCT and Haar transforms.D.4 MatlabOnly/snip_transforms_ilaplace.m. [ Python version]D.34 A segment of one channel of the original ECG data.D.35 Original and reconstructed ECG signals with DCT of N = 32 points and discarding 26 (high-frequency) coefficients.D.36 Performance of five DCT-based ECG coding schemes. The number of points is varied N ∈{4,8,32,64,128} and K = 1,2,…,M − 1.D.37 A zoom of the eye region of the Lenna image.D.5 MatlabBookFigures/figs_transforms_dctimagecodingD.6MatlabOctaveBookExamples/ ex_transforms_check_orthogonality.mD.38 Alternative representation of the DTFS / DFT of x[n] = 10cos (π 6 n + π∕3) using fftshift.D.7 MatlabOctaveCodeSnippets/snip_transforms_fftshift.mD.39 Five cosine signals xi[n] = 10cos (Ωn) with frequencies Ω = 0, 2π∕32, 4π∕32, π, 31π∕16 for i = 0,1,2,16,32, and the real part of their DTFS using N = 32 points. D.8 MatlabOctaveCodeSnippets/snip_transforms_DTFS_sinusoid.m. [ Python version]D.40 Analysis with DFT of 32 points of x[n] composed by three sinusoids and a DC level.D.41 Spectrum of a signal x[n] = 4cos ((2π∕6)n) with period of 6 samples obtained with a 16-point DFT, which created spurious components.D.42 Explicitly repeating the block of N cosine samples from Figure ø:ref fig:dftexamples4 to indicate that spurious components are a manifest of the lack of a perfect cosine in time-domain.D.9 MatlabOctaveCodeSnippets/snip_transforms_DTFS_pulses.m. [ Python version]D.43 Three periods of each signal: pulse train x[n] with N = 10 and N1 = 5 and amplitude assumed to be in volts (a), the magnitude (b) and phase (c) of its DTFS.D.44 Behavior when N1 of Figure ø:ref fig:dtfs_pulse is decreased from N1 = 4 to 1.D.10 MatlabOctaveCodeSnippets/snip_transforms_DTFT_pulse.m. [ Python version]D.45 DTFT of an aperiodic pulse with N1 = 5 non-zero samples and DTFT estimates obtained via a DFT of N = 20 points.D.46 A version of Figure ø:ref fig:dtft_via_dft using a DFT of N = 256 points.D.47 A version of Figure ø:ref fig:dtft_via_dft using freqz with 512 points representing only the positive part of the spectrum.D.48 Reproducing the graphs generated by freqz in Figure ø:ref fig:dtft_via_freqz.D.11 MatlabOctaveCodeSnippets/snip_transforms_freqz.m. [ Python version]
D.11 Comments and Further Reading
E Analog and Digital Systems
E.1 What You Will Learn
E.2 Contrasting Signals and Systems
E.1 Relations of the impulse response to the system function and frequency response of LTI systems.
E.3 A Quick Discussion About Filters
E.1 Ideal magnitude specifications for lowpass and highpass filters.E.2 Magnitude of the frequency response of a practical analog filter in linear scale (|H(f)|, top) and in dB (20log10|H(f)|), which should be compared to the ideal case of Figure ø:ref fig:low_highpass_specs.
E.3.1 Cutoff and natural frequencies
E.2 Nomenclature of special frequencies.
E.3.2 Filter masks
E.3 Example of specification masks for designing low and highpass filters.E.4 Example of specification mask for designing bandpass filters.
E.4 Linear Time-Invariant Systems
E.5 Diagram of systems, emphasizing the linear and time-invariant (LTI) systems and the systems described by linear, constant-coefficient differential (or difference) equations (LCCDE).
E.4.1 Impulse response and convolution for LTI systems
E.6 Example of convolution between x[n] = 2δ[n] − 3δ[n − 1] and h[n] = δ[n] − 2δ[n − 1] + δ[n − 2].E.1 MatlabOctaveFunctions/ak_convolution.m
E.4.2 Advanced: Convolution properties
E.2MatlabOctaveFunctions/ak_convolution2.mE.3MatlabOctaveCodeSnippets/snip_systems_ak_convolution.m. [ Python version]
E.4.3 Advanced: Convolution via correlation and vice-versa
E.4MatlabOctaveCodeSnippets/snip_systems_convolution_correlation.m. [ Python version]
E.4.4 Advanced: Discrete-time convolution in matrix notation
E.4.5 Approximating continuous-time via discrete-time convolution
E.7 Convolution of a pulse p(t) = 4rect(5t − 0.1) with itself, obtained with Listing ø:ref code:snip_systems_continuous_discrete_conv.E.5 MatlabOctaveCodeSnippets/snip_systems_continuous_discrete_conv
E.4.6 Frequency response: Fourier transform of the impulse response
Eigenfunctions
E.8 Frequency response of H(ω) = 1 jω+2 represented in polar form: magnitude (top) and phase (bottom).E.9 Frequency response represented in polar form: magnitude (top) and phase (bottom).E.10 Version of Figure ø:ref fig:freq_response_onepole_discrete obtained with the command freqz(1,[1 -0.7]).
E.4.7 Fourier convolution property
E.4.8 Circular and fast convolutions using FFT
E.6MatlabOctaveCodeSnippets/snip_systems_circularConvolution.m. [ Python version]E.7MatlabOctaveCodeSnippets/snip_systems_overlapAdd.m. [ Python version]
E.5 Advanced: Sampling and Signal Reconstruction Revisited
E.5.1 A proof sketch of the sampling theorem
E.11 Spectrum Xs(f) of a sampled signal xs(t) obtained by the convolution between X(f) and P(f) as indicated in Eq. (ø:ref eq:sampledSignalGeneralRevisitedFrequency).
E.5.2 Energy and power of a sampled signal
E.5.3 Energy / power conservation after sampling and reconstruction
E.5.4 Sampling theorem uses a strict inequality
E.5.5 Undersampling or passband sampling
E.12 Passband signal with BW = 25 Hz and center frequency fc = 70 Hz.E.13 Result of sampling X(f) in Figure ø:ref fig:filt_fpga_sinal_anlg with Fs = 56 Hz.
E.5.6 Sampling a complex-valued signal
E.14 Sampling with Fs = 450 Hz a complex-valued signal with non-symmetrical spectrum.
E.5.7 Signal reconstruction and D/S conversion revisited
D/S conversion revisited
E.15 Result of converting x[n] with spectrum X(ejΩ into xs(t) with Xs(ω) = X(ejωTs) via a D/S conversion using Fs = 10 Hz.
Signal reconstruction
E.16 Extended version of Figure ø:ref fig:canonicalDSPChain using an arbitrary reconstruction filter h(t) and incorporating the filters A(s) and R(s).E.17 Reconstruction of a digital signal with BW = 25 kHz and Fs = 200 kHz using an analog filter with cutoff frequency fc = 25 kHz.E.18 Same as Figure ø:ref fig:dacFilter25khz, but for a signal with BW = fc = 80 kHz.
Combined digital filtering and D/S steps
E.6 Advanced: First and Second-Order Analog Systems
E.6.1 First-order systems
E.6.2 Second-order systems
E.3 Some distinct options for the numerator of a SOS.E.19 Relations between natural frequency ωn, pole center frequency ω0, decay rate α and damping ratio ζ for a pair of complex conjugate poles.E.20 Magnitude of the frequency response for the SOS expressed by Eq. (ø:ref eq:secondOrder1) and Eq. (ø:ref eq:secondOrder4).E.21 Time-domain performance parameters for an underdamped system based on its step response.E.4 Parameters of a second-order system as described by Eq. (ø:ref eq:secondOrder1).E.8 MatlabOctaveCodeSnippets/snip_systems_sos_parameters.m. [ Python version]
E.7 Advanced: Bandwidth and Quality Factor
E.7.1 Bandwidth and quality factor of poles
Bandwidth of a pole
E.22 Bandwidth BW = f2 − f1 defined by the cutoff frequencies where the gain falls − 3 dB below the reference value at f0.
Pole bandwidth in continuous-time
Pole bandwidth in discrete-time
Quality factor of poles
E.7.2 Bandwidth and quality factor of filters
Bandwidth definitions for signals and systems
E.9Code/MatlabBookFigures/figs_digicomm_enbwE.23 DTFT magnitude in dB of a 4-th order Butterworth filter with cutoff frequency of 50 Hz and the equivalent ideal filter with absolute bandwidth of 102.4 Hz.
Quality factor for filters
E.8 Importance of Linear Phase (or Constant Group Delay)
E.10MatlabOctaveCodeSnippets/snip_systems_linear_phase_system.m. [ Python version]E.24 Effect of adding a linear phase e−j2πN0k∕N (N0 = 4 and N = 50) to the DTFS of x[n] resulting in a delayed version y[n] = x[n − 4] .E.25 Effect of adding the specified nonlinear phase (top) to the pulse in Figure ø:ref fig:ex_linear_phase, which leads to a distorted signal (bottom).
E.9 Advanced: Surface acoustic wave (SAW) and other filters
E.26 Performance of a commercial SAW filter. The insertion gain IG(f) at two resolutions at the left plot and superimposed to the group delay at the right.E.5 Specifications of a commercial SAW filter.E.27 Performance of a commercial ceramic filter.E.6 Specifications of a commercial ceramic filter where fn = 455 kHz is the nominal frequency and fc is the center of the 6-dB BW.
E.10 Introduction to Digital Filters
E.10.1 Designing simple filters using specialized software
Example of analog filter design
E.28 Lowpass active analog filter designed with Texas Instruments’ FilterPro software.E.11 MatlabBookFigures/figs_systems_elliptic.mE.29 Frequency response of filters designed in Listing ø:ref code:figs_systems_elliptic. The magnitude specification masks are indicated. Note that the phase was unwrapped with the command unwrap for better visualization.
Example of digital filter design
E.30 The canonical interface of a digital filter H(z) with the analog world via A/D and D/A processes.E.12 Digital filter implementation in pseudo-code.E.31 Comparison of two analog filters with its digital counterpart of Eq. (ø:ref eq:butter_digital). The “ideal” analog corresponds to Eq. (ø:ref eq:butter_analog) while the “10% tolerance” corresponds to its realization using the schematic of Figure ø:ref fig:analog_filter.
E.10.2 Distinct ways of specifying the “ripple” deviation in filter design
E.13MatlabOctaveCodeSnippets/snip_systems_IIR_design.m. [ Python version]
E.10.3 LCCDE digital filters
E.32 Comparison of analog filter specification (a) and two corresponding digital versions assuming Fs = 2000 Hz: (b) was obtained with ω = Ωs and (c) uses the convention adopted in Matlab/Octave.
E.10.4 FIR, IIR, AR, MA and ARMA systems
E.10.5 Filter frequency scaling
E.14MatlabOnly/snip_systems_filter_conversion.m. [ Python version]
E.10.6 Filter bandform transformation: Lowpass to highpass, etc.
E.15MatlabOnly/snip_systems_lowpass_to_bandpass.m. [ Python version]E.16MatlabOnly/snip_systems_bandstop_conversion.m. [ Python version]E.17MatlabOctaveCodeSnippets/snip_systems_elliptic_filter_design.m. [ Python version]E.18MatlabOctaveCodeSnippets/snip_systems_FIR_filter_design.m. [ Python version]
E.11 IIR Filter Design
E.11.1 Direct IIR filter design
E.11.2 Indirect IIR filter design
E.11.3 Methods to convert continuous into discrete-time system functions
Matched Z-transform or pole-zero matching
E.19MatlabOctaveCodeSnippets/snip_systems_notch.m. [ Python version]
Impulse invariance
E.20MatlabOctaveCodeSnippets/snip_systems_impulseinvariance
Step invariance
Backward difference and forward difference
Bilinear or Tustin’s
E.11.4 Summary of methods to convert continuous-time system function into discrete-time
E.7 Methods to convert H(s) into H(z).
E.12 Bilinear Transformation: Definition and Properties
E.21MatlabOctaveCodeSnippets/snip_systems_sos_bilinear.m. [ Python version]E.22MatlabOctaveCodeSnippets/snip_systems_check_sosbilinear.m. [ Python version]
Derivation of the bilinear transformation
E.12.1 Bilinear mapping between s and z planes and vice-versa
E.33 Examples (a) and (b) of bilinear mappings from the unit circle in z to s plane. Mappings (c) and (d) of chosen points in s to z plane. Each example shows the points identified by numbers in their original and mapped planes.
E.12.2 Non-linear frequency warping imposed by bilinear
E.34 Version of Figure ø:ref fig:frequency_axes in which the mapping between ω and Ωses the bilinear transformation instead of the fundamental equation ω = Ωs of Eq. (ø:ref eq:freqdiscrete2continuous).E.35 Bilinear leads to a nonlinear warping between ω (rad/s) and Ωrad). This example uses Fs = 0.5 Hz such that ω = tan (Ω2).E.23 MatlabOctaveCodeSnippets/snip_systems_bilinearmap.m. [ Python version]E.36 Relation imposed by the bilinear transformation between ω (rad/s) and Ωrad) for Fs = 100 Hz. In this case, the frequency ω0 = 540.4 rad/s is mapped to Ω = 2.433 ± k2π rad.E.37 |H(f)| corresponding to H(s) = 101(s − 1)(s − 1)∕[(s + 1)(s + 1 − j10)(s + 1 + j10)] of Eq. (ø:ref eq:hs_for_bilinear), to illustrate the bilinear transformation.E.38 Frequency responses from H(z) obtained via the bilinear transformation of H(s) in Eq. (ø:ref eq:hs_for_bilinear) using Fs = 1, 3, 5 and 7 Hz.E.39 Magnitude (in dB) for bilinear transformations of H(s).
E.12.3 Tracking the frequency warping provoked by bilinear
E.24MatlabOctaveCodeSnippets/snip_systems_sampling.mE.40 Frequency responses of Hs(ωa) given by Eq. (ø:ref eq:example_of_Hs), Hz(ejΩ obtained via bilinear and Hz(ejωdTs) (from top to bottom).
E.12.4 Advanced: Properties of the bilinear transformation
E.13 System Design with Bilinear Transformation
E.41 Three categories of bilinear applications and the respective choices of the sampling frequency Fs in the bilinear transformation depends on the application, and can be arbitrary in the case of digital filter design.
E.13.1 Bilinear for IIR filter design
E.8 Main approximations adopted in the design of continuous-time filters H(s) with their pros and cons with respect to phase and magnitude (mag.).E.42 Steps of IIR filter design using the bilinear transformation when the filter requirements are in discrete-time (frequencies in radians).E.25 MatlabOctaveCodeSnippets/snip_systems_iir_bilinear.m
Bilinear sampling rate is arbitrary in IIR filter design
E.43 Version of Figure ø:ref fig:frequency_axes and Figure ø:ref fig:frequency_axes_bilinear_simpler that considers both the bilinear transformation and the conversion of continuous to discrete-time via ω = Ωs.
Bilinear IIR design can start from continuous-time specifications
E.44 Steps for designing an IIR filter H(z) using the bilinear transformation, assuming a lowpass filter. The set of requirements can be in discrete (Φ) or continuous-time (ϕ) domain.E.26 MatlabOctaveCodeSnippets/snip_systems_iir_elliptic.m
E.13.2 Bilinear for matching a single frequency
E.45 Steps for matching a single frequency ωm using the bilinear transformation when a continuous-time system function G(s) and Fs are provided.E.46 Version of Figure ø:ref fig:bilinear_freq_responses for which bilinear used pre-warping for obtaining ωa = ωd = 20 rad/s.E.9 Pre-warped bilinear as a method to convert H(s) into H(z).
E.13.3 Bilinear for mimicking G(s)
E.14 FIR Filter Design
E.14.1 A FIR filter does not have finite poles
E.14.2 The coefficients of a FIR coincide with its impulse response
E.14.3 Algorithms for FIR filter design
E.47 Mask for a differentiator filter specified with the syntax for arbitrary filter magnitudes.
E.14.4 FIR design via least-squares
E.48 Frequency response of filters obtained with firls.E.27 MatlabOctaveCodeSnippets/snip_systems_firls.m. [ Python version]
E.14.5 FIR design via windowing
E.49 FIR design described in both time and frequency domains.E.28 MatlabOctaveCodeSnippets/snip_systems_rectangular_window.m
E.14.6 Two important characteristics: FIRs are always stable and can have linear phase
E.14.7 Examples of linear and non-linear phase filters
E.29Group delay estimation for linar phase systemE.30Code for plotting the group delay and phase.E.50 Group delay and phase for a channel represented by a symmetric FIR with linear phase and constant group delay of 3 samples.E.51 Group delay and phase for a channel represented by a non-symmetric FIR h=[0.3 -0.4 0.5 0.8 -0.2 0.1 0.5] with non-linear phase.
E.14.8 Zeros close to the unit circle may impact the phase linearity
E.14.9 Four types of symmetric FIR filters
E.10 Types of linear-phase FIR filtersE.31 MatlabOctaveCodeSnippets/snip_systems_FIR_types.mE.52 Impulse and frequency responses for the four types of symmetric FIR filters exemplified in Listing ø:ref code:snip_systems_FIR_types.
E.15 Realization of Digital Filters
E.53 Two distinct realizations of y[n] = 5x[n] − 5x[n − 1].
E.15.1 Structures for FIR filters
E.54 Two structures for FIR realizations.
E.15.2 Structures for IIR filters
E.55 Two alternatives for implementing the digital filter of Eq. (ø:ref eq:iir_example).E.56 IIR of Eq. (ø:ref eq:iir_example) implemented with the transposed direct form II. The intermediate diagram in (a) is obtained by transposing Figure ø:ref fig:iir_direct_2, while (b) simply reorganizes it.E.32 MatlabOctaveCodeSnippets/snip_systems_residuez.mE.11 Matlab/Octave functions to convert among the formats: transfer function (tf), zero-pole (zp) and second order sections (sos)E.33 MatlabOctaveCodeSnippets/snip_systems_SOS_decomposition.m. [ Python version]E.57 Realization of Eq. (ø:ref eq:iir_example) with transposed direct form II second order sections.
E.15.3 Running a digital filter using filter or conv
E.15.4 Advanced: Effects of finite precision
Quantization of the filter coefficients via examples
E.34MatlabOctaveCodeSnippets/snip_systems_coefficient_quantization.m. [ Python version]E.35MatlabOnly/snip_systems_Matlab_coef_quant.m. [ Python version]E.58 The original magnitude response of the 8-th order filter and its 16-bits per coefficient Q7.8 quantized version (bi = 7 and bf = 8).E.59 Zeros and poles for the original and quantized filters discussed in Figure ø:ref fig:quantized_filter1.E.60 Magnitude of quantized filter with Q10.15 using 26 bits (bi = 10 and bf = 15) and the original filter of order 8 in Figure ø:ref fig:quantized_filter1.E.61 Magnitude responses for original filter of order 14 and its quantized version with b = 26 bits (bi = 10 and bf = 15).E.62 Zeros and poles for the corresponding filter in Figure ø:ref fig:quantized_filter3. Note the occurrence of poles outside the unit circle, which make the quantized filter unstable.
Roundoff errors during the signal processing
E.36MatlabBookFigures/figs_systems_roundoffErrorsE.63 Example of filter outputs with floating-point double precision and fixed-point using Q2.3 generated with Listing ø:ref code:roundoffErrors.
E.16 Advanced: Minimum Phase Systems
E.64 Frequency responses of Hnon(z) and its minimum-phase counterpart Hmin(z).E.37 MatlabBookFigures/figs_systems_minphaseE.65 Group delay for the non-minimum and minimum phase systems of Figure ø:ref fig:minphase_example.
E.17 Advanced: Multirate Processing
E.17.1 Upsampler and interpolator
E.66 Original spectrum X(ejΩ (top) and its upsampled version Q(ejΩ = X(ejLΩ with L = 4 (bottom).E.67 Zoom of the bottom plot of Figure ø:ref fig:upsampler_spectrum: due to the upsampling by L = 4, Q(ejΩ has four replicas of the original lowpass spectrum.
E.17.2 Downsampler and decimator
E.68 Original spectrum Z(ejΩ (top) and the result Y (ejΩ (bottom) of downsampling it by M = 3.
E.18 Applications
E.38MatlabOctaveThirdPartyFunctions/ak_universalChannelInitialization.mE.39MatlabOctaveThirdPartyFunctions/ak_universalChannel1.mE.40MatlabOctaveThirdPartyFunctions/ak_universalChannel2.mE.69 Screenshot of the DigitalFilter GUI after user informed the coefficients of the filter obtained with Matlab/Octave command [B,A]=butter(4,0.5).E.70 Result of experiment with Listing ø:ref code:snip_systems_realtimeLoopback and soundboards of two computers: an analog bandpass filter implemented with the canonical interface of Figure ø:ref fig:canonical_interface.E.41 MatlabOnly/snip_systems_realtimeLoopback.m. [ Python version]E.71 Result similar to Figure ø:ref fig:filterWith2Computers but without silence intervals in acquired signal (top plot).E.72 Magnitudes of frequency responses for two resonators with H(s) as in Eq. (ø:ref eq:resonator).E.42 MatlabOctaveCodeSnippets/snip_systems_Qfactor.m. [ Python version]E.43MatlabOctaveFunctions/ak_showQfactors.mE.73 Poles (left) and magnitude |H(ω)| (right) for the sixth-order Butterworth filter of Listing ø:ref code:showQfactors.E.74 Similar to Figure ø:ref fig:freq_response_butter6ord, but with a sixth-order Chebyshev Type 1 filter.E.75 Zero-pole plot (top) and magnitude in dB (bottom) for the sixth-order elliptic filter of Listing ø:ref code:showQfactors.E.76 Sound system phase frequency response ∠H(f) estimated from an impulse response.E.44 MatlabOctaveCodeSnippets/snip_systems_phase_estimation.m. [ Python version]E.77 DSL line topology and corresponding impulse responseE.78 Impulse response and group delay of IIR filter obtained with [B,A]=butter(8,0.3).E.79 Input signal x[n] and its FFT.E.45 MatlabOctaveCodeSnippets/snip_systems_filtering.m. [ Python version]E.80 Input x[n] and output y[n] signals obtained via convolution with truncated h[n].E.81 Input x[n] and output y[n] signals obtained via filter.E.82 Output y[n] aligned with the input x[n] and corresponding error x[n] − y[n].E.46 MatlabOctaveCodeSnippets/snip_systems_compensate_grpdelay.m. [ Python version]E.83 Filtering in blocks of N = 5 samples but not updating the filter’s memory.E.47 MatlabOctaveCodeSnippets/snip_systems_filtering_blocks.m. [ Python version]E.48MatlabOctaveCodeSnippets/snip_systems_matrixBlockConvolutions.m. [ Python version]E.84 Linear phase FIR channel obtained with h=fir1(10,0.8).E.85 IIR channel obtained with [B,A]=butter(5,0.8).
E.19 Comments and Further Reading
F Spectral Estimation Techniques
F.1 What You Will Learn
F.2 Introduction
F.3 Windows for spectral analysis
F.3.1 Popular windows
F.1 Selected windows w[n] of duration N = 32 samples in time-domain.F.2 The DTFTs W(ejΩ of the windows in Figure ø:ref fig:windowsTimeDomain.F.1 MatlabOctaveCodeSnippets/snip_frequency_windows.m. [ Python version]F.3 The DTFT of windows in Figure ø:ref fig:windowsTimeDomain with their values normalized such that |W(ejΩ| = 1 for Ω 0 rad.
Equations describing popular windows
F.3.2 Figures of merit applied to windows
F.1 Difference in dB between the window main lobe and highest sidelobe amplitudes.
Positioning sinusoids with respect to the FFT bin
F.4 Comparison of DTFT and DFT/FFT of a bin-centered signal x[n] = 6cos ((α2π∕N)n), with α = 8 and N = 32, using a rectangular window.F.5 Comparison of DTFT and DFT/FFT of a non-bin-centered signal x[n] = 6cos ((α2π∕N)n), with α = 8.5 and N = 32, using a rectangular window.
Estimating sinusoid amplitude and observing the scalloping loss
F.2MatlabOctaveCodeSnippets/snip_frequency_scalloping.m. [ Python version]F.6 Comparison of DTFT and DFT/FFT of a bin-centered signal x[n] = 6cos ((α2π∕N)n), with α = 8 and N = 32, using a flattop window.F.7 Comparison of DTFT and DFT/FFT of a non-bin-centered signal x[n] = 6cos ((α2π∕N)n), with α = 8.5 and N = 32, using a flattop window.F.8 Comparison of DTFT and DFT/FFT of a non-bin-centered signal x[n] = 6cos ((α2π∕N)n), with α = 8.5 and N = 32, using a Hann window.
Advanced: FFT Interpreted as a Filter Bank
F.9 DFT filter bank with rectangular window of N = 8 samples. The circles mark the DFT bin centers. The filter for k = 3 is emphasized.F.10 DFT filter bank with Kaiser window of N = 8 samples. The filter for k = 6 is emphasized.
Advanced: Relation between roots location and spectrum
F.11 Relationship between roots location and spectrum for a rectangular window with N = 32 samples.F.12 Relationship between roots location and spectrum for a Kaiser window with N = 32 samples.
F.3.3 Leakage
F.13 Spectrum leakage when a cosine x[n] = 3cos (Ωn), with Ω = 1 rad, is windowed with a rectangular window w[n] of duration N = 14 samples.F.14 Spectrum leakage when the cosine x[n] = 3cos (n) of Figure ø:ref fig:leakage_example is now windowed with a rectangular window w[n] of duration N = 50 samples.F.15 Spectrum leakage when the cosine x[n] = 3cos (n) of Figure ø:ref fig:leakage_example is now windowed with a rectangular window w[n] of duration N = 1000 samples.
F.3.4 Picket-fence effect
Revisiting scalloping loss as the combined effects of leakage and picket-fence
F.3MatlabOctaveCodeSnippets/snip_frequency_fftCosineExample.mF.16 Comparison of DTFT and DFT/FFT for bin-centered x[n] = 6cos ((α2π∕N)n), with α = 2 and N = 8 using a rectangular window.F.17 Version of Figure ø:ref fig:leak_picket_ex1 for a (worst-case) not bin-centered x[n] = 6cos ((α2π∕N)n), with α = 2.5 and N = 8 using a rectangular window.
Advanced: Scalloping loss of sinusoid multiplied by rectangular window
F.18 Comparison of DTFT and DFT/FFT for a constant signal x[n] = 6cos ((α2π∕N)n) = A, with α = 0 (centered at DC) and N = 8, using a rectangular window.
F.3.5 Advanced: Only a bin-centered sinusoid leads to an FFT without visible leakage
F.19 Comparing FFT results for non-periodic and a periodic but not bin-centered signals.F.20 Comparison of DTFT and DFT for x[n] = 6cos ((α2π∕N)n) with α = 50 (left) and α = 30.5 (right) N = 256 using a rectangular window.
F.3.6 Frequency resolution of the overall spectral analysis
F.3.7 Example of using windows in spectral analysis
F.4MatlabOctaveCodeSnippets/snip_frequency_sequence_generation.m. [ Python version]F.21 Comparison of spectra obtained with four windows in case both sinusoids are bin-centered (left plots) and not (right plots).F.5 MatlabOctaveCodeSnippets/snip_frequency_analysis.m. [ Python version]F.22 Individual spectra of the two sinusoids superimposed obtained using the Kaiser window.F.23 Individual spectra of the two sinusoids superimposed, obtained using the rectangular window.
F.4 Energy spectral density (ESD)
F.6MatlabOctaveCodeSnippets/snip_frequency_exp_esd.m
F.4.1 ESD of discrete-time signals
F.4.2 Advanced: Different definitions of ESD and their units
F.4.3 Units of ESD when angular frequencies are adopted
F.2 ESD functions. E is the total energy and the column “Ind. var” (independent variable) indicates the units and symbols used for the independent variable of each function. The units of G(f), G(ω)∕(2π) and G(ejΩ∕(2π) are J/Hz, J/(rad/s) and J/rad, respectively.
F.5 Power spectral density (PSD)
F.5.1 Main property of a PSD
F.3 PSD functions. P is the average power and the column “Ind. var.” indicates the units and symbols used for the independent variable of each function. Ff and Fω denote the Fourier transform in Hertz and rad/s, respectively. The units of S(f), S(ω)∕(2π) and S(ejΩ∕(2π) are W/Hz, W/(rad/s) and W/rad, respectively.
F.5.2 PSD definitions
F.24 Important categories of signals. Some of these features need to be taken in account when defining the PSD function.
F.5.3 Advanced: PSD of random signals
F.5.4 Advanced: PSD of deterministic and periodic signals
F.5.5 Advanced: Fourier modulation theorem applied to PSDs
F.6 Mean-square (MS) spectrum
F.7 Filtering Random Signals and the Impact on PSDs
F.7.1 Response of LTI systems to random inputs
F.7.2 Filtering continuous-time signals that have a white PSD
F.7.3 Advanced: Filtering discrete-time signals that have a white PSD
Discrete-time white noise
Converting white noise from continuous to discrete-time
F.25 PSD Sx(f) of a continuous-time white noise with N0∕2 = 3 W/Hz (top) and its discrete-time counterpart Sx(ejΩ obtained with Fs = 200 Hz (bottom).
Converting white noise from discrete to continuous-time
Gaussian signal filtered by LTI system remains Gaussian
F.8 Nonparametric PSD Estimation via Periodogram
F.26 ESD, PSD and MS spectrum with respective units, and two methods for estimating PSDs that can also be used to estimate the ESD and MS spectrum.
Matlab/Octave adopted conventions for periodograms
F.8.1 Periodogram of periodic signals and energy signals
F.8.2 Examples of continuous-time PSD estimation with periodograms
F.7MatlabOctaveCodeSnippets/snip_frequency_normalized_periodogram.m. [ Python version]F.27 Periodogram of x[n] = 10cos ((2π∕64)n) in dBW/Hz estimated by periodogram.m with a 1024-point FFT and assuming Fs = 8 kHz.F.8 MatlabOctaveCodeSnippets/snip_frequency_cosines_psd.m. [ Python version]F.28 Periodogram of two bin-centered sinusoids at 250 and 500 Hz, calculated via Matlab and its definition.F.29 Periodograms of two bin-centered sinusoids at 250 and 500 Hz, calculated with the rectangular and Hamming windows.F.30 Periodograms of two non-bin-centered sinusoids at f1=507.8125 and f2=257.8125 Hz calculated with the rectangular and Hamming windows.F.9 MatlabOctaveCodeSnippets/snip_frequency_noisy_cosine.m. [ Python version]F.31 Periodograms of a cosine contaminated by AWGN at an SNR of − 3 dB with an FFT of N = 1024 points (top plot) and 16384 (bottom). In this case the SNR cannot be inferred directly from the noise level.F.10 MatlabOctaveCodeSnippets/snip_frequency_comparePeriodograms.m. [ Python version]F.11MatlabOctaveCodeSnippets/snip_frequency_correctPeriodograms.m. [ Python version]
F.8.3 Relation between MS spectrum and periodogram
F.12MatlabOctaveCodeSnippets/snip_frequency_mssFromPeriodogram.m. [ Python version]
F.8.4 Estimation of discrete-time PSDs using the periodogram
F.8.5 Examples of discrete-time PSD estimation
F.13MatlabOctaveCodeSnippets/snip_frequency_periodogram.m. [ Python version]F.32 Discrete-time PSD of x[n] = 10cos ((2π∕8)n) in linear scale estimated with periodograms.F.14 MatlabOctaveCodeSnippets/snip_frequency_not_bin_cent_cos.m. [ Python version]F.33 Periodogram and MS spectrum for a sum of sinusoids. Both are in dB scale.F.15 MatlabOctaveCodeSnippets/snip_frequency_noise_PSD.m. [ Python version]F.34 Periodograms of a white noise with power equal to 600 W estimated with N = 300 (top) and N = 3000 (bottom) samples.
F.8.6 Estimating the PSD from Autocorrelation
F.16MatlabOctaveCodeSnippets/snip_frequency_PSD_using_xcorr.mF.35 PSD of a filtered white noise x[n] estimated via the autocorrelation.F.17 MatlabOctaveCodeSnippets/snip_frequency_impulse_PSD.m. [ Python version]
F.9 Nonparametric PSD Estimation via Welch’s method
F.9.1 The periodogram variance does not decrease with N
F.9.2 Welch’s method for PSD estimation
F.36 PSD of a white noise x[n] with power equal to 600 W estimated by Welch’s method with M = 32 (top) and M = 256 (bottom) samples per segment.F.18 MatlabOctaveCodeSnippets/snip_frequency_pwelch.m. [ Python version]F.37 PSD of a filtered white noise x[n] estimated by Welch’s method.F.19 MatlabOctaveCodeSnippets/snip_frequency_filtered_noise_PSD.m
F.10 Parametric PSD Estimation via Autoregressive (AR) Modeling
F.38 The prediction-error filter is A(z) = 1 −A~(z), where A~(z) provides a prediction y~[n] of the current n-th signal sample y[n], based on previous samples y[n − 1],…,y[n − P].F.4 LPC result for different orders P for a ramp signal with added noise.F.20 MatlabOctaveCodeSnippets/snip_frequency_aryule.m. [ Python version]F.5 LPC result for different orders P for an AR(2) realization.
F.10.1 Advanced: Spectral factorization
F.21MatlabOctaveCodeSnippets/snip_frequency_ma1.m
F.10.2 AR modeling of a discrete-time PSD
F.22MatlabOctaveCodeSnippets/snip_frequency_lpcExample.m. [ Python version]F.23MatlabOctaveCodeSnippets/snip_frequency_AR_PSD.m. [ Python version]
F.10.3 AR modeling of a continuous-time PSD
F.24MatlabOctaveCodeSnippets/snip_frequency_AR_continuousPSD.m. [ Python version]
F.10.4 Advanced: Yule-Walker equations and LPC
F.10.5 Examples of autoregressive PSD estimation
F.25MatlabOctaveCodeSnippets/snip_frequency_PSD_estimation.mF.39 PSDs estimated from a realization y[n] of a autoregressive process. The model adopted for the AR-based estimation matches the one used to generate y[n].F.26 MatlabOctaveCodeSnippets/snip_frequency_MA_process_PSD.m. [ Python version]F.40 PSDs estimated from a realization y[n] of a moving average process that does not match the model adopted for the AR-based estimation.
F.11 Time-frequency Analysis using the Spectrogram
F.11.1 Definitions of STFT and spectrogram
F.41 PSD (top) and spectrogram (bottom) of a cosine that has its frequency increased from Ω 2π∕30 to 2π∕7 and its power decreased by 20 dB at half of its duration.F.27 MatlabOctaveCodeSnippets/snip_frequency_cosine_spectogram.mF.42 All twelve DTMF symbols: 1-9,*,0,, each one composed by a sum of a low [697,770,852,941] and a high [1209,1336,1477] (Hz) frequencies.
F.11.2 Advanced: Wide and narrowband spectrograms
F.43 Example of narrowband spectrogam of a speech signal.F.44 Example of wideband spectrogam of a speech signal.F.28 MatlabOctaveCodeSnippets/snip_frequency_narrow_wide_spec.m. [ Python version]
F.12 Applications
F.45 DTFT magnitude of a cosine of frequency Ω = 1.7279 rad.F.46 DTFT and FFT magnitudes of a cosine of frequency Ω = 2.1206 rad.F.29 MatlabOctaveCodeSnippets/snip_frequency_msspectrum.m. [ Python version]F.30MatlabOctaveCodeSnippets/snip_frequency_not_bin_cent_pwelch.m. [ Python version]F.31MatlabOctaveCodeSnippets/snip_systems_smothing_FFT.m. [ Python version]F.47 Sound system magnitude frequency response |H(f)| estimated from an impulse response.F.48 Sound system magnitude frequency response |H(f)| estimated from a white noise input.F.32 MatlabOctaveCodeSnippets/snip_systems_recorded_noise.m. [ Python version]F.49 Spectrogram and tracks of the first four formant frequencies estimated via LPC for a speech sentence “We were away”.F.33 MatlabOctaveCodeSnippets/snip_frequency_formant_frequencies.m. [ Python version]F.34MatlabOctaveFunctions/ak_spectralDistortion.mF.35Applications/SpeechAnalysis/spectralDistortion.m
F.13 Comments and Further Reading
Glossary
Text Conventions
Main Abbreviations
Main Symbols
Bibliography
Index