{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4c18befe-eab7-4708-8a74-e9441ece565c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from scipy.optimize import curve_fit\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "sqrt = np.sqrt\n",
    "pi = np.pi\n",
    "cos = np.cos\n",
    "sin = np.sin\n",
    "exp = np.exp\n",
    "e = np.e"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "527687f5-fb63-42ed-8c58-8bc0947710a9",
   "metadata": {},
   "source": [
    "#### Резонансная частота"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f52fc1dd-97d6-4e7a-b7dd-8a22bb8e372d",
   "metadata": {},
   "source": [
    "$\\nu_0 = \\dfrac{1}{2\\pi\\sqrt{LC}}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "04171738-ae97-463b-88b6-b03b55fdd617",
   "metadata": {},
   "outputs": [],
   "source": [
    "def nu_rez(L, C):\n",
    "    return 1 / (2 * np.pi * np.sqrt(L * C))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "87c14a27-7683-433e-9705-51496e137f17",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1591.5494309189535"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nu0 = nu_rez(100e-3, 0.1e-6)\n",
    "nu0"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "33a9c25f-3478-497c-901a-c0950a8eda55",
   "metadata": {},
   "source": [
    "## R = 0 Ом"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5090862a-7622-49a9-b593-fc9ec6c2fc4e",
   "metadata": {},
   "source": [
    "freq = 1588 Hz\n",
    "\n",
    "period = 35.322 ms\n",
    "\n",
    "N = 30 cycles"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e90b3bb4-0a43-41a4-b492-56aa947dcde0",
   "metadata": {},
   "source": [
    "#### Логарифмический декремент затухания для возрастающего участка"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cdea4329-0b53-42a2-adde-7732df34fce9",
   "metadata": {},
   "source": [
    "$\\Theta = \\dfrac1n \\ln{\\dfrac{U_0 - U_k}{U_0 - U_{k+n}}}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 535,
   "id": "e779f269-18e0-4fcf-8246-1d583d807edb",
   "metadata": {},
   "outputs": [],
   "source": [
    "def Theta_incr(U0, U1, U2, n):\n",
    "    return 1/n * np.log((U0 - U1) / (U0 - U2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 536,
   "id": "bd9fdd97-683e-433d-92d4-f9de5128a7ab",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(r'raw-data/zug-incr_0-Ohm.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 537,
   "id": "e5ddc315-92fa-4f83-ad2b-2c3fce1dcbb8",
   "metadata": {},
   "outputs": [],
   "source": [
    "U0 = df['U0[mV]']\n",
    "U1 = df['U1[mV]']\n",
    "U2 = df['U2[mV]']\n",
    "n  = df['n']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 538,
   "id": "3b8e013b-90e0-4362-9cc7-37dd8ed80e91",
   "metadata": {},
   "outputs": [],
   "source": [
    "Theta_0_up = np.mean(Theta_incr(U0, U1, U2, n))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e060b5da-df82-4dd3-9460-4dda42d95439",
   "metadata": {},
   "source": [
    "#### Логарифмический декремент затухания для затухающего участка"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c74f90a-5e1f-4c15-bc02-4d1e92969c3e",
   "metadata": {},
   "source": [
    "$\\Theta = \\dfrac1n \\ln{\\dfrac{U_m}{U_{m+n}}}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 539,
   "id": "8fa641b1-02ff-4dcf-a96f-a1d5f4db4796",
   "metadata": {},
   "outputs": [],
   "source": [
    "def Theta_decr(U1, U2, n):\n",
    "    return 1/n * np.log((U1) / (U2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 540,
   "id": "3f2b73c7-ae5d-4b0d-9c06-6e8b166e8e43",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(r'raw-data/zug-decr_0-Ohm.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 541,
   "id": "19e0dea5-398d-4a9a-9b85-b2d40b490e58",
   "metadata": {},
   "outputs": [],
   "source": [
    "U1 = df['U1[mV]']\n",
    "U2 = df['U2[mV]']\n",
    "n  = df['n']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 542,
   "id": "ee60a941-494b-41eb-bbfa-8acc7f1a5748",
   "metadata": {},
   "outputs": [],
   "source": [
    "Theta_0_down = np.mean(Theta_decr(U1, U2, n))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e9e0a89-497c-47c6-8d3a-fe53c8c3a800",
   "metadata": {},
   "source": [
    "## R = 100 Ом"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e45b382-3569-4936-85ab-3a7f000d3a59",
   "metadata": {},
   "source": [
    "freq = 1588 Hz\n",
    "\n",
    "period = 12 ms\n",
    "\n",
    "N = 8 cycles"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0144e75d-9946-4e5c-92ae-aeb25e3c9c2e",
   "metadata": {},
   "source": [
    "#### Логарифмический декремент затухания для возрастающего участка"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 543,
   "id": "1b70235a-4380-4dad-b79d-e8c61456db1b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(r'raw-data/zug-incr_100-Ohm.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 544,
   "id": "19501640-3c96-4bde-b319-a8a93a8af87a",
   "metadata": {},
   "outputs": [],
   "source": [
    "U0 = df['U0[mV]']\n",
    "U1 = df['U1[mV]']\n",
    "U2 = df['U2[mV]']\n",
    "n  = df['n']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 545,
   "id": "6a45f573-5c8a-4305-b19a-a9b2a1c3c812",
   "metadata": {},
   "outputs": [],
   "source": [
    "Theta_100_up = np.mean(Theta_incr(U0, U1, U2, n))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7614fa42-560a-43f2-8d6f-1f588cf9370b",
   "metadata": {},
   "source": [
    "#### Логарифмический декремент затухания для затухающего участка"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 546,
   "id": "59668c21-71a4-4344-b872-404bb4f57781",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(r'raw-data/zug-decr_100-Ohm.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 547,
   "id": "503635a4-5238-48d0-ae6c-8683229dd21a",
   "metadata": {},
   "outputs": [],
   "source": [
    "U1 = df['U1[mV]']\n",
    "U2 = df['U2[mV]']\n",
    "n  = df['n']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 548,
   "id": "00f8bf87-300b-4a5c-970e-8b7ba27c704e",
   "metadata": {},
   "outputs": [],
   "source": [
    "Theta_100_down = np.mean(Theta_decr(U1, U2, n))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "efc47c94-16e9-4563-b50d-429068642829",
   "metadata": {},
   "source": [
    "**50 Hz**\n",
    "\n",
    "L = 100.10 mH\n",
    "\n",
    "R1 = 0.028 Ohm\n",
    "\n",
    "R2 = 100.02 Ohm"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f6adb735-9274-4a05-b9b2-d85e185fec62",
   "metadata": {},
   "source": [
    "**500 Hz**\n",
    "\n",
    "L = 100.08 mH\n",
    "\n",
    "R1 = 0.029 Ohm\n",
    "\n",
    "R2 = 100.02"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f1ea607-25e1-4d4b-a714-1bfc49aebe29",
   "metadata": {},
   "source": [
    "**1500 Hz**\n",
    "\n",
    "L = 100.10 mH\n",
    "\n",
    "R1 = 0.03 Ohm\n",
    "\n",
    "R2 = 100.02 Ohm"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9e6602f9-a7d5-4ae3-9f4c-a59e8eeb7c81",
   "metadata": {
    "tags": []
   },
   "source": [
    "## Обработка результатов"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "1f7346fe-ff2a-49bf-b88c-d39669c10c08",
   "metadata": {},
   "outputs": [],
   "source": [
    "L = 100.1e-3\n",
    "R_L = 30.418\n",
    "\n",
    "C = 0.1e-6\n",
    "\n",
    "R_0 = 0.03 + R_L\n",
    "R_100 = 100.02 + R_L\n",
    "\n",
    "omega_0 = 1 / sqrt(L * C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ff21d53e-d707-4089-ac20-68bd31d14bee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.09"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "0.003 * 30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 560,
   "id": "c05d1ce9-8f2c-4a91-9508-a63c208f3ab8",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "def Q_m(R):\n",
    "    return 1/R * sqrt(L/C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 561,
   "id": "b1ae28c4-1375-4be2-8bc0-0cb6aa4752b1",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "def Uc(nu, I):\n",
    "    omega = 2*pi * nu\n",
    "    R = 100\n",
    "    I_0 = I * 1e-6\n",
    "    return I_0 * sqrt((1 + Q_m(R)**2 * (omega / omega_0)**2) / (1 + Q_m(R)**2 * (omega/omega_0 - omega_0/omega)**2)) / (omega * C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 562,
   "id": "4b4aa70f-3da5-4ca8-a252-acc25ae395f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "nominals = [0, 100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 563,
   "id": "ba14f53c-8756-47e1-9df2-67491ba67e57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 136420 characters]\n",
      "text/plain": [
       "<Figure size 1800x1200 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(6, 4), dpi=300)\n",
    "\n",
    "plt.minorticks_on()\n",
    "plt.grid(which='minor', linestyle=':', color='0.9')\n",
    "plt.grid(which='major', linestyle='-', color='0.8', lw=0.3)\n",
    "\n",
    "for nominal in nominals:\n",
    "    df = pd.read_csv(rf'raw-data/U-on-nu_{nominal}Ohm.csv')\n",
    "    \n",
    "    U0 = df['U[mV]'][0]\n",
    "    nu0 = df['nu[Hz]'][0]\n",
    "    df.sort_values('nu[Hz]', inplace=True)\n",
    "    \n",
    "    U = df['U[mV]']\n",
    "    nu = df['nu[Hz]']\n",
    "    \n",
    "    plt.errorbar(nu / nu0, U / U0, yerr=0.02, xerr=0.001, lw=1, ls='', marker='.', markersize=3, label=rf\"$R = {nominal} \\Omega$\", ds='default')\n",
    "    # plt.plot(U_line, line(U_line, opt[0], opt[1]), label=r\"Fitting: $R_{diff}=$ \" + f\"{-1/opt[0]:.1f}\" + r\"$\\pm 1.48$ kOhm\", color=\"tab:red\", linestyle='-')\n",
    "    \n",
    "plt.plot([nu.min() / nu0, nu.max() / nu0], 1/sqrt(2)*np.ones(2), lw=0.5, color='tab:red')\n",
    "    \n",
    "plt.xlabel(r\"$\\nu / \\nu_0$\")\n",
    "plt.ylabel(r\"$U / U_0$\")\n",
    "\n",
    "plt.legend()\n",
    "plt.savefig(rf\"images\\U-on-nu_{nominal}-Ohm.png\", facecolor=\"white\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "602425bf-32ad-4274-9644-73aaedbfce8f",
   "metadata": {
    "tags": []
   },
   "source": [
    "### Добротность контура"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6166bb5d-0ef6-4b85-b451-be1c9bc3bcf9",
   "metadata": {},
   "source": [
    "$Q = \\omega_0 / (2 \\Updelta \\Omega)$"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7505e329-ebe8-470a-8742-8f4f41e11d7d",
   "metadata": {},
   "source": [
    "#### 0 Ом"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6334afe3-0687-4c26-8815-f5de0c21063e",
   "metadata": {},
   "source": [
    "Измерено с помощью графика"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 564,
   "id": "83226024-d3e2-4e3b-a7a3-a87093f7df8f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "31.57894736842106"
      ]
     },
     "execution_count": 564,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta = 19/12 * 0.02\n",
    "1/ delta"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c5d3f03-64e4-4d7f-8b92-eabb40ad167e",
   "metadata": {},
   "source": [
    "Измерено с помощью декремента затухания"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 565,
   "id": "1ce8f727-5f65-44e0-9f56-febf8b05bcdf",
   "metadata": {},
   "outputs": [],
   "source": [
    "Q_0_up   = pi / Theta_0_up\n",
    "Q_0_down = pi / Theta_0_down"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 566,
   "id": "02a9bd30-3095-4e61-a09a-3b62f57916e1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "27.544114281648127"
      ]
     },
     "execution_count": 566,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_0_up"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 567,
   "id": "931625dd-330b-40ea-a598-909f576726fc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "33.31527433170166"
      ]
     },
     "execution_count": 567,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_0_down"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "109f12d3-9ee9-4685-91ed-6bbbccc92763",
   "metadata": {},
   "source": [
    "Теоретическое значение через параметры контура"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 568,
   "id": "84a27584-4a5d-4de4-a420-1e79f24ea4a0",
   "metadata": {},
   "outputs": [],
   "source": [
    "Q_0_theor = 1/30.42 * sqrt(L/C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 569,
   "id": "597ddbb6-4546-43cb-9bf7-d15cf6c86301",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "32.88954224399937"
      ]
     },
     "execution_count": 569,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_0_theor"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab7a8655-2b49-4878-a20d-afcffda1690b",
   "metadata": {},
   "source": [
    "#### 100 Ом"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86edade7-27be-43dd-be6d-170abb028187",
   "metadata": {},
   "source": [
    "Измерено с помощью графика"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 570,
   "id": "7d2d4c0c-e32d-4288-b560-d873bcaa7d7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.194244604316546"
      ]
     },
     "execution_count": 570,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta = 0.02*(3/4 + 6 + 1/5)\n",
    "1 / delta"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b730de11-edf2-49ef-b5e0-c0f18aa8a3c4",
   "metadata": {},
   "source": [
    "Измерено с помощью декремента затухания"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 571,
   "id": "20657dc8-324d-4c69-9b43-9a7655aa601b",
   "metadata": {},
   "outputs": [],
   "source": [
    "Q_100_up   = pi / Theta_100_up\n",
    "Q_100_down = pi / Theta_100_down"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 572,
   "id": "94166bf0-a157-421d-9813-a400a4a20610",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.464127136906649"
      ]
     },
     "execution_count": 572,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_100_up"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 573,
   "id": "01a61f8d-0605-4a30-b099-209ada14e0d5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10.729236997993604"
      ]
     },
     "execution_count": 573,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_100_down"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "274ec737-31de-4b5f-8c59-ed92f62cbea1",
   "metadata": {},
   "source": [
    "Теоретическое значение через параметры контура"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "517b0434-85b8-4ed1-b6a8-9212c961f4e5",
   "metadata": {},
   "outputs": [],
   "source": [
    "Q_100_theor = 1/R_100 * sqrt(L/C)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3086936a-0e87-4021-aa84-5b50a10ec136",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.670309841169453"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Q_100_theor"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbbe0a3d-5435-4d61-9b4e-1ed95c68aaf1",
   "metadata": {},
   "source": [
    "### Результат"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95bd81de-461f-4a4c-942e-47c2564d1116",
   "metadata": {
    "tags": []
   },
   "source": [
    "| $R$ Ом | $R_\\text{конт}$ | Рез. кривая | Возрастание | Затухание | $f(LCR)$ |\n",
    "|--------|-----------------|-------------|-------------|-----------|----------|\n",
    "| 0      | 30.45           | 31.58       | 27.54       | 33.32     | 32.89    |\n",
    "| 100    | 130.44          | 7.19        | 7.46        | 10.73     | 7.67     |"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 222,
   "id": "f0a43157-e11d-49eb-8fd7-5ee23f87b86d",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "from scipy.integrate import solve_ivp\n",
    "\n",
    "pi = np.pi\n",
    "sqrt = np.sqrt\n",
    "cos = np.cos\n",
    "sin = np.sin"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 243,
   "id": "14ed78c9-5bc4-42ba-bf62-a7bbc312d912",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "eps_0 = 10\n",
    "R = 100\n",
    "L = 100e-3\n",
    "C = 0.1e-6\n",
    "omega = 2 * pi * 1588\n",
    "omega_0 = 1 / sqrt(L * C)\n",
    "phi_0 = -pi/2\n",
    "gamma = R/(2 * L)\n",
    "\n",
    "t = np.linspace(-1e-3, 1e-3, 2000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "id": "bf8de66c-e2c2-4672-bd7f-989ee7314cba",
   "metadata": {
    "jupyter": {
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "def deriv_y(t, y):\n",
    "    u, udot = y\n",
    "    return [udot, omega_0**2 * eps_0 * cos(omega * t + phi_0) - 2 * gamma * udot - omega_0**2 * u]\n",
    "\n",
    "yinit = [0, 0]\n",
    "y = solve_ivp(deriv_y, [-1e-3, 1e-3], yinit)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "id": "09bee18a-e788-438b-9716-dd82f1761128",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true,
     "source_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x1c6481b8820>]"
      ]
     },
     "execution_count": 245,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 175700 characters]\n",
      "text/plain": [
       "<Figure size 3600x1200 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(12, 4), dpi=300)\n",
    "plt.grid()\n",
    "plt.plot(t, 10 * cos(omega * t + phi_0))\n",
    "plt.plot(y.t, y.y[0])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.10.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
