Frequency Response Calculation - espotek-org/Labrador GitHub Wiki
This wiki is a how-to guide for making frequency response calculation. It is an extension of the description communicated in the pull request (PR) and it might be of interest to first look at the PR.
Interface wise, it is located under the oscilloscope tab, next to Frequency Spectrum.
There are multiple reasons to calculate the frequency response of a circuit-under-test (CUT). These are
- knowing the type of the system (low-pass, high-pass, band-pass, ...)
- knowing the linear range of the system
- calculating the time constant in RC circuits
- and others
When calculating a frequency response, we need
- an input source to excite the circuit-under-test (CUT) with sinusoidal waveform of varying frequencies, and
- two output measurements for capturing the excitation and response waveforms
Espotek/Labrador happens to include both a signal generator and oscilloscopes under the same board and we will use Signal Gen CH1 for exciting the CUT and Oscilloscope CH1/CH2 for capturing both excitation and response waveforms.
Here is an example circuit-under-test (CUT) for measuring the frequency response of an RC circuit.
Frequency response calculation steps
The frequency response calculation is an automatic process and it starts plotting the response over the default frequency range, step, and plot type. Update the input controls in order to specify your preferred frequency response plot.
- With in the given input frequency range, Signal Gen CH1 selects a frequency to excite the CUT and captures 1 cycle of excitation and response waveforms
- using least squares regression, it fits a sinusoidal to captured waveforms
Excitation fitting: F1(t) = 1.5sin(2π1000*t + θ)
Response fitting: F2(t) = 1.25sin(2π1000*t + θ - 0.628)
- Then after, it calculates gain(dB) and phase response (degree)
Gain(dB): 20 * log10(1.25/1.5) = −1.5836
Phase (degree) = -0.628 * 180.0/π = -36
- After that, it plots the frequency response (gain or phase)
- Finally, it updates the next frequency value on Signal Gen CH1 and restarts the process
Special note
Since the frequency response calculation relies on least square regression, it is imperative the residual errors are within bound. If that is not the case, the re-constructed waveform is not representative of the captured waveform and we simply discard it from the frequency response plot.
It is also possible the residual error gets very large due to a lower input voltage. Thus increasing the input voltage will increase the response voltage and might help to plot the response over a wide frequency range. (Watch-out the input voltage from exceeding the power supply unit (PSU), else the input gets clipped)