Code covered by the BSD License
AD_DA(x,Xmin,Xmax,Levels)
This function represents an A/D converter in series with a D/A converter
conv_DHT(x,y)
Linear Convolution calculated via the Discrete Hartley Transform (DHT).
conv_DHT2(x,h)
Linear Convolution Calculated via the Discrete Hartley Transform (DHT).
decimator(x,h,K)
This function performs decimation on the input signal x[n]
diffft(x)
Decimation-In-Frequency (DIF) FFT.
fastconv(x,y)
Compute a linear (or circular, depending on relative signal lengths) convolution via DFT's.
fastconv2(x,y)
Compute a linear convolution via DFT's.
fastconv3(x,y,nx,ny)
Compute a linear convolution via DFT's.
fastconvreal(x,y)
Compute the linear convolution of 2 real sequences via FFT's.
fastconvreal2(x,y,nx,ny)
Compute the linear convolution of 2 real sequences via FFT's.
fft241(x,y)
This function calculates the DFT's of two real N-point sequences, by means of
fftreal(x)
This function calculates the FFT of an N-point real signal x[n] by use
fraction_delay(x, h, N)
This function induces a fractional sample delay by 1/N to the input signal x.
fraction_delay3(x, h1, M,... This function induces a fractional sample delay by M/L to the input signal x.
fraction_sample(x,h,M,N)
Fractional Sampling Rate Conversion function by a factor of M/N.
ifft241(X,Y)
This function calculates the IDFT's of 2 given complex DFT sequences of common length N,
ifftreal(X)
This function computes the ifft of an N-point complex DFT sequence which corresponds
ifftreal2(X)
This function computes the ifft of an N-point complex DFT sequence which corresponds
interpolator(x,h,L)
This function performs interpolation on the input signal x[n]
method2_idft(X)
method3_idft(X)
my_CTFT(x,dt,freq_type)
Continuous Time Fourier Transform Approximation.
my_CZT(x,M,W,A)
Fast chirp z-transform (CZT) computation.
my_Co_IDCT(X)
Inverse Discrete Cosine Transform Computation.
my_DCT(x)
Discrete Cosine Transform Computation.
my_DCT_2D(X)
Two-dimensional DCT computation.
my_DFT(x)
This function calculates the DFT of the input signal x.
my_DFT2(x)
Direct DFT Computation using the definition formula.
my_DHT(x)
This function calculates the Discrete Hartley Transform of a real
my_DHT2(x,time_ind)
This function calculates the Discrete Hartley Transform of a real
my_DHT3(x)
This function calculates the Discrete Hartley Transform of a real
my_DTFT(x,n)
DTFT Computation using the definition formula.
my_DTFT2(x,n,w)
DTFT Computation using the definition formula.
my_DTFT3(x,n1)
DTFT Computation using the definition formula.
my_DTFT4(x,n)
DTFT Computation using the matrix multiplication method.
my_FFT_2D(X)
Two-dimensional DFT computation.
my_IDCT(X)
Inverse Discrete Cosine Transform Computation.
my_IDCT_2D(X)
Two-dimensional Inverse DCT computation.
my_IDFT(X)
This function calculates the Inverse DFT of the input signal X.
my_IFFT_2D(X)
Two-dimensional Inverse FFT computation.
my_Re_IDCT(X)
Discrete Cosine Transform Computation.
my_conv(x,h,nx,nh)
This function computes the linear convolution of input signals x[n] and h[n].
my_conv2(x,h,nx,nh)
This function computes the linear convolution of input signals x[n] and h[n].
my_downsample(x,M)
This function performs downsampling to input row vector x
my_spectrogram(x,Fs,N,M,w... This function calculates the spectrogram of the input signal x.
my_upsample(x,N)
This function performs upsampling to input row vector x
overlap_add(x,h,half_segm... Linear Convolution computation by use of overlap-and-add method.
overlap_save(x,h,segment_... Linear Convolution computation via the Overlap-and-Save method.
overlap_save2(x,h,segment... Linear Convolution computation via the Overlap-and-Save method. Version 2.
radix2fft(x)
Radix-2, Decimation-In-Time (DIT), FFT Computation function.
radix4fft(x)
Radix-4, Decimation-In-Time (DIT), FFT Computation function.
shiftdown(x,n)
This function shifts down (up) the contents of a column vector
shiftright(x,n)
This function shifts to the right (left) the contents of a row vector
splitradixfft(x)
Split-Radix, Decimation-In-Time (DIT),FFT Computation function.
uniform_quantizer(x,L,max... This function implements a uniform quantizer of L levels.
zero_phase_dft(x)
This function is an implementation of the "zero phase DFT" of a given
zero_phase_dtft(x,M)
This function is an implementation of the "zero phase DTFT" of a given
bench_dtft.m This routine compares the time needed to execute various DTFT implementations.
ex213.m
ex214.m Exercise 2.1.4. Time Axis Alteration.
ex216.m Exercise 2.1.6. The Geometric Series.
ex217.m Exercise 2.1.7. Characteristics of Signals.
ex231.m Exercise 2.3.1. The Convolution Sum.
ex232.m
ex233.m Exercise 2.3.3. Introduction to Graphical Convolution.
ex234.m Exercise 2.3.4. Convolving Sequences.
ex235.m Exercise 2.3.5. More Convolution.
ex236.m Exercise 2.3.6. Beginning and End Points.
ex245.m Exercise 2.4.5. Nonlinear Difference Equations.
ex246.m Exercise 2.4.6. Autocorrelation.
ex247.m Exercise 2.4.7. Cross-Correlation.
ex248.m Exercise 2.4.8. Random Sequences.
ex249.m Exercise 2.4.9. Gaussian Random Sequences.
ex311.m
ex3110.m
ex3111.m
ex312.m
ex314.m Exercise 3.1.4. Hermitian Symmetry.
ex315.m Exercise 3.1.5. Periodicity of the Discrete-Time Fourier Transform.
ex316.m Exercise 3.1.6. The Shift Property.
ex317.m Exercise 3.1.7. The Modulation Property.
ex318.m
ex319.m
ex321.m Exercise 3.2.1. Digital Filters.
ex322.m
ex323.m
ex324.m Exercise 3.2.4. Filtering a Sinusoid and a Random Sequence.
ex331.m
ex332.m
ex333.m
ex411.m Exercise 4.1.1. Ideal Sampling (Frequency Domain).
ex412.m
ex413.m Exercise 4.1.3. Ideal Reconstruction (Frequency Domain).
ex414.m Exercise 4.1.4. Commercial D/A Converters.
ex415.m
ex421.m Exercise 4.2.1. Quantization.
ex422.m
ex423.m
ex424.m
ex431.m Exercise 4.3.1. Downsampling.
ex432.m Exercise 4.3.2. Aliasing in Downsampling.
ex433.m Exercise 4.3.3. Upsampling.
ex435.m
ex436.m
ex437.m
ex438.m
ex5110.m Exercise 5.1.10. Stability.
ex5111.m
ex513.m Exercise 5.1.3. Producing Pole/Zero Plots.
ex518.m Exercise 5.1.8. Finding System Functions from Poles and Zeros.
ex519.m
ex521.m Exercise 5.2.1. Finding the Inverse z-Transform.
ex5210.m Exercise 5.2.10. Convolution.
ex522.m
ex524.m Exercise 5.2.4. Computing the Inverse z-Transform.
ex525.m
ex527.m
ex528.m Exercise 5.2.8. Modulation.
ex541a.m Exercise 5.4.1.a. Sketching the Magnitude Response.
ex541b.m Exercise 5.4.1.b. Sketching the Magnitude Response.
ex542a.m Exercise 5.4.2.a. Sketching Magnitude Responses from Pole/Zero Plots.
ex542b.m Exercise 5.4.2.b. Sketching Magnitude Responses from Pole/Zero Plots.
ex542c.m Exercise 5.4.2.c. Sketching Magnitude Responses from Pole/Zero Plots.
ex542d.m Exercise 5.4.2.d. Sketching Magnitude Responses from Pole/Zero Plots.
ex542e.m Exercise 5.4.2.e. Sketching Magnitude Responses from Pole/Zero Plots.
ex544.m Exercise 5.4.4. Poles and Zeros at Infinity.
ex545a.m
ex545b.m Exercise 5.4.5.b. Determining Poles and Zeros from the DTFT.
ex546.m Exercise 5.4.6. Interaction of Poles and Zeros.
ex611.m Exercise 6.1.1. Some Simple DFT Properties.
ex612.m Exercise 6.1.2. Direct DFT Evaluation.
ex613.m
ex614.m Exercise 6.1.4. Spatial Aliasing.
ex621.m Exercise 6.2.1. Introduction to Circular Shifting.
ex622.m Exercise 6.2.2. Circular Convolution.
ex623.m Exercise 6.2.3. Circular and Linear Convolutions.
ex624.m Exercise 6.2.4. Linear Convolutions via Circular Convolutions.
ex625.m Exercise 6.2.5. Circular Shift.
ex626.m Exercise 6.2.6. Circular Modulation.
ex631.m
ex632.m
ex633.m Exercise 6.3.3. Computational Complexity of the FFT.
ex634.m
ex635b.m
ex635c.m
ex636.m Exercise 6.3.6. FFT for Real Input Sequences.
ex637.m Exercise 6.3.7. Goertzel's Algorithm.
ex641.m Exercise 6.4.1. Evaluating Linear Convolutions Using the DFT.
ex642.m Exercise 6.4.2. Overlap-and-Add Method.
ex643.m Exercise 6.4.3. Extracting Good Values from Circular Convolutions.
ex644.m Exercise 6.4.4. Overlap and Save Method.
ex645.m Exercise 6.4.5. Use of the DFT for Deconvolution.
ex651.m
ex653.m Exercise 6.5.3. The Discrete Cosine Transform (DCT).
ex654.m Exercise 6.5.4. The Discrete Hartley Tranform.
ex655.m Exercise 6.5.5. Transform Coding.
ex656.m
hartley.m Relation of Hartley Transform with DFT:
spectro_demo.m Short-Time Fourier Transform (Spectrogram) Demo.
test_fastconv3.m This program tests function fastconv3.m to ensure its proper functionality.
test_idct.m Test fot my_DCT.m and my_IDCT.m scripts.
test_idct2D.m Testing the my_DCT.m and my_IDCT.m on an image
test_ifft241.m Test custom function: ifft241.m
View all files
MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".
by
Ilias Konsoulas
29 Oct 2012
(Updated
25 Nov 2013 )
These files are the MatLab solutions of exercises contained in the above DSP lab textbook.
overlap_save2(x,h,segment_length)
function y = overlap_save2(x,h,segment_length)
% Linear Convolution computation via the Overlap-and-Save method. Version 2.
% In order for this function to work, L3 (length(long)) >= L1 ( = segment_length) >= L2 (length(short)).
% Make sure x and h are row vectors for subsequent processing:
x = x(:).';
h = h(:).';
N = length(x);
M = length(h);
if N>M
long = x;
short = h;
else
long = h;
short = x;
end
L1 = segment_length;
L2 = length(short);
L3 = length(long);
m = ceil((N+M-1)/L1);
long = [long zeros(1, m*L1-L3)]; % Pad long with zeros to the least integer multiple of
% L1 (i.e. segment_length) greater than or equal to N+M-1.
y = zeros(1,m*L1); % This is the pre-allocated size of the output sequence
% y[n] where the convolution values will be stored.
y_current = zeros(1,L1+L2);
short_block = short;
for k=0:m-1
if k ==0 % First x_block processing. We introduce some zeros in the beginning of long_block as necessary.
long_block = [zeros(1,L2) long(1:L1)];
% Compute the circular convolution of size L1 + L2.
y_current = cconv(long_block,short_block,L1+L2);
y(1:L1) = y_current(L2+1:end);
else
long_block = long(k*L1- L2+1:(k+1)*L1); % Successive long_blocks are of size L1+L2 overlapping by L2 samples.
% Compute the circular convolution of size L1 + L2.
y_current = cconv(long_block,short_block,L1+L2);
y(k*L1+1:(k+1)*L1) = y_current(L2+1:end) ; % Keep only the last L1 samples of y_current.
end
end
% Finally, keep only the valid entries of y[n]:
y = y(1:N+M-1);
Contact us