czt
Chirp Z-transformation.
| Library |
|
Arguments
Input arguments
# x — input signal
+
vector | the matrix | three-dimensional array
Details
An input signal specified as a vector, matrix, or three-dimensional array. If x — matrix, a function that transforms columns x. If x — a three-dimensional array, the function works with the first dimension of the array, the size of which is larger 1.
| Типы данных |
|
| Support for complex numbers |
Yes |
# m is the length of the conversion
+
length(x) (by default) | a positive integer scalar
Details
The length of the transformation, specified as a positive integer scalar.
| Типы данных |
|
# w is the ratio between the points of the spiral contour
+
exp(-2im*π/m) (by default) | the complex scalar
Details
The ratio between the points of the spiral contour, defined as a complex scalar.
| Типы данных |
|
| Support for complex numbers |
Yes |
# a is the starting point of the spiral contour
+
1 (default) | the complex scalar
Details
The starting point of the spiral contour, defined as a complex scalar.
| Типы данных |
|
| Support for complex numbers |
Yes |
Output arguments
# y — chirp Z-transform
+
vector | the matrix
Details
Chirp Z is a transformation returned as a vector or matrix.
Examples
CZT of a random vector
Details
Creating a random vector x length 1013. Let’s calculate its DFT using the function czt.
import EngeeDSP.Functions: randn, czt
using Random
Random.seed!(1234)
x = randn(1013, 1)
y = czt(x)
A narrow-band portion of the frequency response
Details
Using the function czt to increase the narrowband portion of the frequency response of the filter.
Let’s design a low-pass FIR filter 30-th order, using the window method. Setting the sampling frequency 1 kHz and the cutoff frequency 125 Hz. We use a rectangular window. Let’s find the transfer function of the filter.
import EngeeDSP.Functions: fir1, rectwin
fs = 1000
h = fir1(30, 125 / (fs/2), rectwin(31))
Calculate the DFT and CZT of the filter. Let’s limit the frequency range of the CZT to the band from 75 before 175 Hz. Generate 1024 a reference point in each case.
import EngeeDSP.Functions: fft, czt
m = 1024
y = fft(h, m)
f1 = 75
f2 = 175
w = exp(-im * 2π * (f2 - f1) / (m * fs))
a = exp(im * 2π * f1 / fs)
z = czt(h, m, w, a)
Let’s build graphs of transformations. Enlarge the area of interest.
fn = (0:m-1) ./ m
fy = fs .* fn
fz = (f2 - f1) .* fn .+ f1
plot(fy, abs.(y), label="FFT")
plot!(fz, abs.(z), label="CZT")
xlims!(50, 200)
xlabel!("Frequency (Hz)")
Algorithms
Function czt uses an FFT of length equal to the next power of two to perform fast convolution when calculating the Z-transform on a given chirp contour [1].