<< FOSSEE_Signal_Processing_Toolbox | FOSSEE_Signal_Processing_Toolbox | _levin >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > _czt

# _czt

Compute the Chirp z-transform.

### Syntax

    y = _czt(x)
    y = _czt(x, m)
    y = _czt(x, m, w)
    y = _czt(x, m, w, a)

### Parameters

x:

  Input scalar or vector.

m:

  Total number of steps. Default is the length of the input signal.

w:

  Ratio between points in each step. Default is exp(-2*%i*%pi/m).

a:

  Starting point in the complex plane. Default is 1.

### Description

The `czt` function computes the Chirp z-transform of the input signal `x`. It calculates the frequency response starting at `a` and stepping by `w` for `m` steps. The parameter `a` is a point in the complex plane, and `w` is the ratio between points in each step. The radius increases exponentially, and the angle increases linearly.

### Examples

    // --- Signal Generation ---
    N = 256
    n = 0:(N - 1);
    f0 = 0.2
    x = sin(2 * %pi * f0 * n);
    // --- CZT Parameters ---
    M = 512
    f_start = 0.1
    f_end   = 0.3
    w = exp(-2 * %i * %pi * (f_end - f_start) / M);
    a = exp(2 * %i * %pi * f_start);
    // --- CZT Computation ---
    X_czt = _czt(x, M, w, a);
    // --- Frequency Axis ---
    freq_czt = f_start + (0:(M - 1)) * (f_end - f_start) / M;
    // --- Peak Frequency Detection ---
    [_, idx_max] = max(abs(X_czt))
    detected_freq = freq_czt(idx_max)
    disp("Detected frequency = " + string(detected_freq));
    // --- Plot ---
    clf();
    plot2d(freq_czt', abs(X_czt)');
    xtitle("CZT Spectrum of Sine Wave at f = " + string(f0));
    xlabel("Normalized Frequency");
    ylabel("|X(f)|");
    xgrid();

Report an issue
<< FOSSEE_Signal_Processing_Toolbox | FOSSEE_Signal_Processing_Toolbox | _levin >>