Linear Frequency Modulation

Chirp

lfm-sig-plot.svg

(asdf:load-system :lisp-stat)
(asdf:load-system :num-utils)
(asdf:load-system :plot/vega)

(in-package :ls-user)

(defparameter n (floor 25e3)) ; number of samples
(defparameter fs 25e3)      ; sampling frequency rate

; tvec is vector of length n, with step size 1 / fs representing
; the time duration of the signal

(defparameter tvec (apply 'vector
                          (iota n :step (/ 1D0 fs))))

; tau is the duration of the modulation
; beta is the Rayleigh bandwidth
; beta/tau is the slope of the linear function that determines the
; rate of frequency modulation
(defparameter tau 1)
(defparameter beta (/ 25 tau)) 

; sig is the signal using the equation above
(defparameter sig (ecos (e* pi (/ beta tau) (eexpt tvec 2)) ))

; creating data frame to pass values to plot
(defdf sig-lfm-df (matrix-df #(:time :amplitude)
                             (aops:stack-cols tvec sig)))

; plot signal
(plot:plot
 (vega:defplot lfm-plot
   `(:title "Linear Frequency Modulation Example"
            :width 1200
            :height 500
            :data (:values ,sig-lfm-df)
            :mark (:type :line)
            :encoding (:x (:field :time
                                  :type :quantitative
                                  :title "Time [sec]")
                          :y (:field :amplitude
                                     :type :quantitative
                                     :title "Amplitude")))))

References

Richards, Mark A. 2022. Fundamentals of Radar Signal Processing. 3rd ed. McGrawHill.