Last active
December 14, 2015 07:19
-
-
Save tobin/5049621 to your computer and use it in GitHub Desktop.
Experimenting with Numerical Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Matlab code to plot a cavity resonance | |
F = 10; % Finesse | |
f = linspace(-0.5, 1.5, 201); | |
P = 1./(1 + (2/pi) * F^2 * sin(pi*f).^2); | |
plot(f, P); | |
xlabel('free spectral ranges'); | |
ylabel('power buildup'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Python code to plot a cavity resonance | |
import numpy as numpy | |
F = 10 | |
f = numpy.linspace(-0.5, 1.5, 201) | |
P = 1 / (1 + (2/numpy.pi) * F**2 * numpy.sin(numpy.pi * f) ** 2) | |
import matplotlib.pyplot as plt | |
plt.plot(f, P) | |
plt.xlabel("free spectral ranges") | |
plt.ylabel("power buildup") | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from numpy import * | |
from matplotlib.pyplot import * | |
F = 10 | |
f = linspace(-0.5, 1.5, 201) | |
P = 1/ (1 + (2/pi) * F**2 * sin(pi*f)**2) | |
plot(f, P) | |
xlabel("free spectral ranges") | |
ylabel("power buildup") | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment