{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 根据表4-4数据,画出无反馈和有反馈放大电路的幅频特性曲线(Y轴放大倍数Au,X轴频率f)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "# 设置matplotlib库的字体为SimHei,以支持中文显示\n", "plt.rcParams[\"font.sans-serif\"] = [\"SimHei\"]\n", "plt.rcParams[\"axes.unicode_minus\"] = False\n", "plt.rcParams[\"font.size\"] = 14\n", "\n", "# 数据\n", "data = {\n", " \"f\": [0.05, 0.1, 0.159, 0.3, 0.5, 0.75, 1, 3, 5, 6, 7.23, 10, 15, 20],\n", " \"Uin\": [\n", " 0.996,\n", " 0.996,\n", " 0.996,\n", " 0.997,\n", " 0.998,\n", " 0.996,\n", " 0.996,\n", " 0.996,\n", " 0.996,\n", " 0.995,\n", " 0.996,\n", " 0.996,\n", " 0.996,\n", " 0.996,\n", " ],\n", " \"Uo\": [\n", " 1.142,\n", " 2.041,\n", " 2.738,\n", " 3.466,\n", " 3.757,\n", " 3.855,\n", " 3.878,\n", " 3.650,\n", " 3.244,\n", " 3.030,\n", " 2.785,\n", " 2.303,\n", " 1.709,\n", " 1.341,\n", " ],\n", "}\n", "\n", "# 创建数据框\n", "df = pd.DataFrame(data)\n", "\n", "df[\"f\"] = df[\"f\"] * 1000 # 转换为Hz\n", "\n", "# 计算放大倍数\n", "df[\"Au\"] = df[\"Uo\"] / df[\"Uin\"]\n", "\n", "# 绘制幅频特性曲线\n", "plt.figure(figsize=(10, 6))\n", "plt.semilogx(df[\"f\"], df[\"Au\"])\n", "plt.title(\"放大电路的幅频特性曲线\")\n", "plt.xlabel(\"频率 (f/Hz)\")\n", "plt.ylabel(\"放大倍数 (Au)\")\n", "plt.grid(True)\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }