sine wave with a constant frequency is typically written as:
Here:![]()
- f is the frequency in Hz,
- t is the time in seconds,
- 2πft is the angular phase in radians.
When the frequency varies with time—a process known as a frequency sweep—the general form of the signal becomes:
![]()
Where θ(t) is the time-dependent phase, which can be obtained by integrating the instantaneous frequency:
![]()
In a linear sweep, the frequency increases linearly from f0 to f1 over a time interval tt . The instantaneous frequency is given by:
![]()
Integrating this, we obtain the phase:
![]()
Therefore, the signal becomes:
![]()
In a logarithmic (or exponential) sweep, the frequency increases exponentially with time:
![]()
Letting r = f1 / f0, we find the phase by integration:
![]()
Hence, the logarithmic sweep signal is:
![]()
The key relationship is:
![]()
This framework allows us to construct sine wave signals with time-varying frequencies, which are essential in signal analysis, system identification, and acoustic measurements.
![]()
Fig. 1: Logarithmic, fixed and linear sweep waveforms
Listing 1
sine_sweep - sine-wave frequency sweep. in C89 (ANSI-C)/* sine_sweep : Sinusoidal wave frequency sweep * Rev.1.0 (Oct. 18, 2012) (c) 2012 Takayuki Hosoda */ #include <math.h> #define SWEEP_LIN 0 #define SWEEP_LOG 1 double sine_sweep(double t, double tt, double f0, double f1, int opt); double sine_sweep(t, tt, f0, f1, opt) double t; /* time */ double tt; /* sweep time */ double f0; /* start frequency */ double f1; /* stop frequency */ int opt; { if (opt == SWEEP_LOG) { return sin(2 * M_PI * tt * f0 / log(f0 / f1) * (pow(f1 / f0, (t / tt)) - 1.0)); } else { return sin(2 * M_PI * ((f1 - f0) * t * t / (2 * tt) + f0 * t)); } } #ifdef DEBUG #include <stdio.h> int main() { int t; double tt = 10000; double fclk = 10e6; /* 0 - 10000 500kHz..20kHz log sweep */ for (t = 0; t < 10000; t++) { printf("%d\t%.16g\t%.16g\t%.16g\n", t, sine_sweep((double)(t)/fclk, 10000/fclk, 500e3, 20e3, SWEEP_LOG), sine_sweep((double)(t)/fclk, 10000/fclk, 500e3, 20e3, SWEEP_LIN), sin(2*M_PI*t*100e3/fclk)); } return 0; } #endif