Transfer Function
The Transfer Function operation determines the frequency response between two signals, revealing how a system transforms an input signal into an output signal in the frequency domain.
Usage
Cheatsheet
- Input: Exactly two signals (input and output)
- Settings: Assign the correct signals as input and output
- Output: One or two new signals (magnitude and/or phase) in the frequency domain
Prerequisites
- Select exactly two signals as input
- Sufficient data length: At least 4 data points (perferably much more for meaningful results)
- Both signals should be time-aligned (covering the same time period)
- If not, alginment is performed automatically
- Both signals should be uniformly sampled
- If not, resampling is performed automatically
Settings
| Parameter | Values | Description |
|---|---|---|
| Input Signal | Signals | The system’s input signal |
| Output Signal | Signals | The system’s output signal |
| Magnitude | checked / unchecked | If checked, calculates the magnitude response (absolute value of the transfer function) |
| Phase | checked / unchecked | If checked, calculates the phase response (angle of the transfer function) |
| Start Frequency | 0 - End Frequency | Lower frequency limit for analysis; frequencies below this are excluded |
| End Frequency | Start Frequency - ∞ | Upper frequency limit for analysis; frequencies above this are excluded |
| Method | FFT / Welch | FFT: Single transform. Welch: Averaged over segments (recommended for noisy or concatenated data) |
Advanced
| Parameter | Values | Description |
|---|---|---|
| Unit | linear / dB | Output unit for magnitude |
| Zero Padding | 0 - 10.000 | Number of zeros appended to improve frequency resolution (FFT method only) |
| Segment length | 0.1 - 1000 s | Length of each segment for Welch method. Longer = better frequency resolution, shorter = more averaging |
| Overlap | 0 - 0.9 | Overlap between segments for Welch method. 0.5 (50%) is typical |
Output
Depending on the selected Settings, this operation creates a magnitude and/ or a phase signal:
Magnitude Response
- Name:
{output_signal_name} - TF Magnitude - X-Axis: Frequency (Hz)
- Y-Axis: Magnitude (linear or dB)
- Interpretation: Shows how much the system amplifies or attenuates different frequencies
- Name:
Phase Response
- Name:
{output_signal_name} - TF Phase - X-Axis: Frequency (Hz)
- Y-Axis: Phase (radians)
- Interpretation: Shows the phase delay introduced by the system at different frequencies
- Name:
Info
The frequency resolution depends on the input signal length and sample rate. Zero Padding can slightly improve the resolution.
Example Workflow
When analyzing measurement data, a typical workflow might be:
Apply a Lowpass Filter to both signals.
Transfer Function
Take both signals as input and calculate the magnitude.
Moving Average
Apply a Moving Average to the result.
Repeat for multiple measurements of the same system.
Average
Use the Average operation to combine results.
The result is one signal containing the system behaivor characteristics.
This approach allows you to compare the transfer behavior of different systems.
Technical Details
Methods
This operation supports two methods for computing the transfer function:
FFT Method (Default)
The classic single-FFT approach. Best for:
- Clean signals with minimal noise
- Single sweeps or continuous excitation
- When maximum frequency resolution is needed
Welch Method
Divides the signal into overlapping segments, computes the transfer function for each, and averages them. Best for:
- Noisy data - averaging reduces noise
- Concatenated measurements - avoids phase artifacts from time offsets
- Multiple sweeps in one recording - each sweep becomes a segment
- More stable/reproducible results
The Welch method computes:
Where is the Cross-Spectral Density and is the Power-Spectral Density, both computed using Welch’s method with Hanning window and configurable overlap.
When to use Welch
Use the Welch method when:
- You have concatenated multiple measurements
- Your data contains gaps or pauses between sweeps
- You want smoother, more robust results
- Phase accuracy is important
Preprocessing
First, the operation preprocesses the selected signals using the following steps:
- Alignment
- NaN Handling
- Resample
- Zero Padding
Main Operations
FFT Method
The transfer function is computed in the frequency domain using the Fast Fourier Transform (FFT).
The FFT is calculated for both signals using numpy.fft.fft:
The corresponding frequency bins are computed with numpy.fft.fftfreq:
where is the number of samples and is the sample rate.
The transfer function is then calculated as:
Welch Method
The Welch method uses scipy.signal.csd for the Cross-Spectral Density and scipy.signal.welch for the Power-Spectral Density:
- The signal is divided into overlapping segments of length
nperseg - Each segment is multiplied by a Hanning window
- FFT is computed for each segment
- Cross-spectral density and power-spectral density are averaged over all segments
- The transfer function is computed as:
This averaging reduces variance and provides a more stable estimate, especially for noisy data.
Magnitude
The Magnitude is finally calculated by taking the absolute value of the transfer behavior using numpy.absolute:
dB Conversion
If dB is selected, the result is converted to decibels:
Phase
The phase response is calculated as the angle (argument) of the transfer function using numpy.angle:
Postprocessing
The result is filtered to the specified frequency range.
Common Use Cases
- System Identification: Measure the transfer function of an unknown system by applying a known input and measuring the output.
- Filter Charaterization: Analyze the frequency response of analog or digital filters.
- Vibration Analysis: Study how mechanical systems respond to different frequency excitations.
- Control System Design: Analyze plant dynamics for controller design.