Skip to content
Snippets Groups Projects
Commit 38d7f3ac authored by cprutean's avatar cprutean
Browse files

Upload New File

parent e4e16573
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:0c5e3c59 tags:
# Simple Ellipse
%% Cell type:code id:824b5445 tags:
``` python
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
a = 3.0
b = 1.0
# 1D arrays of x and y values
X = np.linspace(-5, 5, 101)
Y = np.linspace(-5, 5, 101)
# create 2D arrays of x and y coordinates
XX, YY = np.meshgrid(X,Y)
# create 2D array of z values
Z = np.sqrt((XX/a)**2+(YY/b)**2)
# plot ellipse
plt.contour(XX, YY, Z)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Ellipse')
plt.show()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment