.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/control_systems/feedback/plot_03_black_negative_feedback_amplifier.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_control_systems_feedback_plot_03_black_negative_feedback_amplifier.py: Black's negative-feedback amplifier =================================== Harold Black (1927), commuting on the Lackawanna ferry, sketched an amplifier that fed a fraction :math:`\beta` of its output back *out of phase*. With a huge open-loop gain :math:`A`, the closed-loop gain :math:`A/(1 + A\beta)` (:func:`~engineeringkit.control_systems.feedback`) is almost exactly :math:`1/\beta`, set by a passive divider rather than by drifting vacuum tubes. Distortion and gain variations shrink by the factor :math:`1 + A\beta`, and the bandwidth grows by the same factor. .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.control_systems import bode, dc_gain, feedback, poles, transfer_function beta = 0.01 wa = 2 * np.pi * 10.0 # open-loop pole [rad/s] .. GENERATED FROM PYTHON SOURCE LINES 24-26 Insensitivity to the tube gain ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 26-35 .. code-block:: Python for A0 in [5e4, 1e5, 1.5e5]: amp = transfer_function([A0], [1 / wa, 1]) closed = feedback(amp, beta) gain = dc_gain(closed) print(f"A0 = {A0:8.0f}: closed-loop gain {gain:.4f}, bandwidth {-poles(closed)[0].real / (2 * np.pi):8.0f} Hz") assert np.isclose(-poles(closed)[0].real, wa * (1 + A0 * beta)) assert np.isclose(gain, A0 / (1 + A0 * beta)) and abs(gain * beta - 1) < 2.5e-3 .. rst-class:: sphx-glr-script-out .. code-block:: none A0 = 50000: closed-loop gain 99.8004, bandwidth 5010 Hz A0 = 100000: closed-loop gain 99.9001, bandwidth 10010 Hz A0 = 150000: closed-loop gain 99.9334, bandwidth 15010 Hz .. GENERATED FROM PYTHON SOURCE LINES 36-38 Gain traded for bandwidth ------------------------- .. GENERATED FROM PYTHON SOURCE LINES 38-50 .. code-block:: Python amp = transfer_function([1e5], [1 / wa, 1]) w = np.logspace(0, 8, 400) fig, ax = plt.subplots() for model, label in [(amp, "open loop $A$"), (feedback(amp, beta), r"closed loop $A/(1+A\beta)$")]: _, mag, _ = bode(model, w) ax.semilogx(w / (2 * np.pi), mag, label=label) ax.set(xlabel="frequency [Hz]", ylabel="gain [dB]", title="Gain-bandwidth exchange") ax.grid(True, which="both", alpha=0.3) ax.legend() plt.show() .. image-sg:: /api/gallery/control_systems/feedback/images/sphx_glr_plot_03_black_negative_feedback_amplifier_001.png :alt: Gain-bandwidth exchange :srcset: /api/gallery/control_systems/feedback/images/sphx_glr_plot_03_black_negative_feedback_amplifier_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.212 seconds) .. _sphx_glr_download_api_gallery_control_systems_feedback_plot_03_black_negative_feedback_amplifier.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/control_systems/feedback/plot_03_black_negative_feedback_amplifier.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_03_black_negative_feedback_amplifier.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_03_black_negative_feedback_amplifier.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_03_black_negative_feedback_amplifier.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_