diff --git a/CodeExamples/SimpleEllipse.ipynb b/CodeExamples/SimpleEllipse.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..0fc7b47a4177dee792e755c390ce139766f6c2aa --- /dev/null +++ b/CodeExamples/SimpleEllipse.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "0c5e3c59", + "metadata": {}, + "source": [ + "# Simple Ellipse" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "824b5445", + "metadata": {}, + "outputs": [], + "source": [ + "import math\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib import rc\n", + "\n", + "a = 3.0\n", + "b = 1.0\n", + "\n", + "# 1D arrays of x and y values\n", + "X = np.linspace(-5, 5, 101)\n", + "Y = np.linspace(-5, 5, 101)\n", + "\n", + "# create 2D arrays of x and y coordinates\n", + "XX, YY = np.meshgrid(X,Y)\n", + "\n", + "# create 2D array of z values\n", + "Z = np.sqrt((XX/a)**2+(YY/b)**2)\n", + "\n", + "# plot ellipse\n", + "plt.contour(XX, YY, Z)\n", + "\n", + "plt.xlabel('x')\n", + "plt.ylabel('y')\n", + "plt.title('Ellipse')\n", + "\n", + "plt.show()" + ] + } + ], + "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.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}