Bode Diagram Calculator

Bode Diagram & Frequency Response Calculator

Analyze Magnitude and Phase Shift for First-Order Systems

Frequency Response Results:

Magnitude (Linear)
Magnitude (dB)
Phase Shift (Degrees)
Phase Lag (Radians)

Understanding the Bode Diagram

A Bode Diagram is a powerful tool used in control systems and electronic engineering to represent the frequency response of a system. It consists of two separate plots: the Magnitude Plot (expressed in decibels) and the Phase Plot (expressed in degrees), both plotted against a logarithmic frequency scale.

Key Concepts of this Calculator:

  • Gain (K): The DC gain of the system at zero frequency.
  • Cut-off Frequency (fc): The frequency where the power drops to half its maximum value (the -3dB point).
  • Magnitude (dB): Calculated as 20 × log10(A), where A is the ratio of output to input amplitude.
  • Phase Shift: Indicates the time delay between the input and output signal, measured in degrees or radians.

The Mathematical Model

This calculator assumes a standard first-order low-pass transfer function:
H(s) = K / (1 + s/ωc).
When you input a specific operating frequency, the tool calculates exactly where on the Bode plot that point would fall.

Example Calculation:

If you have a system with a gain of 1 and a cut-off frequency of 1,000 Hz, and you test it at 1,000 Hz:

  • The magnitude will be approximately -3.01 dB.
  • The phase shift will be exactly -45 degrees.
  • This confirms the definition of the corner (cut-off) frequency for a first-order system.
function calculateBode() { var k = parseFloat(document.getElementById('systemGain').value); var fc = parseFloat(document.getElementById('cutoffFreq').value); var f = parseFloat(document.getElementById('testFreq').value); if (isNaN(k) || isNaN(fc) || isNaN(f) || fc <= 0 || f < 0) { alert("Please enter valid positive numerical values for frequencies."); return; } // Calculation for a first-order low pass system: H(jw) = K / (1 + j(f/fc)) // Magnitude = K / sqrt(1 + (f/fc)^2) var ratio = f / fc; var magnitudeLinear = k / Math.sqrt(1 + Math.pow(ratio, 2)); // Magnitude in dB = 20 * log10(Mag) var magnitudeDB = 20 * Math.log10(magnitudeLinear); // Phase = -arctan(f/fc) var phaseRadians = -Math.atan(ratio); var phaseDegrees = phaseRadians * (180 / Math.PI); // Update UI document.getElementById('magLinear').innerText = magnitudeLinear.toFixed(4); document.getElementById('magDB').innerText = magnitudeDB.toFixed(2) + " dB"; document.getElementById('phaseDeg').innerText = phaseDegrees.toFixed(2) + "°"; document.getElementById('phaseRad').innerText = phaseRadians.toFixed(4) + " rad"; document.getElementById('bodeResult').style.display = 'block'; }

Leave a Reply

Your email address will not be published. Required fields are marked *