BodePlot Block
Performs frequency response sweeps and calculates Gain/Phase margins.
Open BodePlot in BlockWerk →Description
The Bode Plot block performs a frequency response analysis of a linear system. It generates two simultaneous plots:
1. Magnitude (dB) vs Frequency (rad/s): Shows the gain of the system across a range of frequencies. 2. Phase (degrees) vs Frequency (rad/s): Shows the phase shift of the output relative to the input.
This block is essential for analyzing system stability, bandwidth, and resonance characteristics in the frequency domain. It performs an automated frequency sweep by injecting a sinusoidal signal at varying frequencies into the system and measuring the steady-state response.
Mathematical Model
A linear time-invariant (LTI) system $G(s)$ responds to a sinusoidal input $u(t) = A \sin(\omega t)$ with a sinusoidal output $y(t) = A' \sin(\omega t + \phi)$ in steady state.
- Gain: $M(\omega) = \frac{A'}{A} = |G(j\omega)|$
- Magnitude (dB): $M_{dB}(\omega) = 20 \log_{10}(|G(j\omega)|)$
- Phase: $\phi(\omega) = \angle G(j\omega)$
The sweep scans from $\omega_{start}$ to $\omega_{end}$ logarithmicly, calculating points based on $Points Per Decade$.
Parameters
Input Source ID (inputSource)
The ID of a source block (typically a SignalGenerator) that provides the excitation signal.
- Type: string
- Default:
sine1 - Tooltip: The ID of the block providing the sweep signal
Start Frequency (startFreq)
The lower bound of the frequency sweep.
- Type: number
- Default: 0.1 rad/s
- Range: > 0
End Frequency (endFreq)
The upper bound of the frequency sweep.
- Type: number
- Default: 100 rad/s
- Range: > Start Frequency
Points per Decade (pointsPerDecade)
Resolution of the frequency sweep. Higher values provide smoother plots but take longer to compute.
- Type: number
- Default: 10
- Range: 1 to 100
Examples
1-pole Low-Pass Filter
System: $G(s) = \frac{1}{s + 1}$. The Bode plot shows a -3dB cutoff at 1 rad/s and a magnitude slope of -20dB/decade at higher frequencies.
Second-Order Resonant System
System: $G(s) = \frac{\omega_n^2}{s^2 + 2\zeta\omega_ns + \omega_n^2}$. The Bode plot shows a peak (resonance) near $\omega_n$ if the damping ratio $\zeta < 0.707$.
Remarks
- Steady State: The sweep algorithm waits for the system to reach steady state at each frequency before measuring magnitude and phase.
- Linearity: This analysis assumes the system is linear. Results for non-linear systems may be non-deterministic or vary with input amplitude.
- Interactive Tuning: You can adjust the sweep range in real-time to focus on specific regions of interest, such as crossover frequencies.
See Also
- NyquistPlot: Alternative frequency-domain visualization.
- TransferFunction: Define the system being analyzed.
- SignalGenerator: Provide the reference sine wave for the sweep.