Created using Colab

This commit is contained in:
udlbook
2025-01-28 10:50:31 -05:00
parent f1c07f53bf
commit 4e564088a1

View File

@@ -4,7 +4,7 @@
"metadata": { "metadata": {
"colab": { "colab": {
"provenance": [], "provenance": [],
"authorship_tag": "ABX9TyMDnVKMFeK2nRxX862l3xmp", "authorship_tag": "ABX9TyPss+SDCn3GEVlRYmKVEPWE",
"include_colab_link": true "include_colab_link": true
}, },
"kernelspec": { "kernelspec": {
@@ -83,31 +83,6 @@
"execution_count": null, "execution_count": null,
"outputs": [] "outputs": []
}, },
{
"cell_type": "code",
"source": [
"# Function to help plot the data\n",
"def plot(x, y, f, phi0=None, phi1=None):\n",
" fig,ax = plt.subplots()\n",
" ax.scatter(x,y)\n",
" plt.xlim([0,2.0])\n",
" plt.ylim([0,2.0])\n",
" ax.set_xlabel('Input, $x$')\n",
" ax.set_ylabel('Output, $y$')\n",
" ax.set_aspect('equal')\n",
" # Draw line if parameters passed\n",
" x_line = np.arange(0,2,0.01)\n",
" if(phi0 is not None and phi1 is not None):\n",
" y_line = f(x_line, phi0, phi1)\n",
" plt.plot(x_line, y_line,'r-',lw=2)\n",
" plt.show()"
],
"metadata": {
"id": "785wp16FYjt5"
},
"execution_count": null,
"outputs": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"source": [ "source": [
@@ -140,6 +115,31 @@
"execution_count": null, "execution_count": null,
"outputs": [] "outputs": []
}, },
{
"cell_type": "code",
"source": [
"# Function to help plot the data\n",
"def plot(x, y, f, phi0=None, phi1=None):\n",
" fig,ax = plt.subplots()\n",
" ax.scatter(x,y)\n",
" plt.xlim([0,2.0])\n",
" plt.ylim([0,2.0])\n",
" ax.set_xlabel('Input, $x$')\n",
" ax.set_ylabel('Output, $y$')\n",
" ax.set_aspect('equal')\n",
" # Draw line if parameters passed\n",
" x_line = np.arange(0,2,0.01)\n",
" if(phi0 is not None and phi1 is not None):\n",
" y_line = f(x_line, phi0, phi1)\n",
" plt.plot(x_line, y_line,'r-',lw=2)\n",
" plt.show()"
],
"metadata": {
"id": "785wp16FYjt5"
},
"execution_count": null,
"outputs": []
},
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "source": [