summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--execsumm/ExecutiveSummaryDraft.tex41
-rw-r--r--graph.py14
3 files changed, 12 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 79203d9..fc28933 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
.POSIX:
.SUFFIXES: .tex .pdf
+PYTHON = python
all: progreport/document.pdf execsumm/document.pdf
progreport/document.pdf: progreport/document.tex format.tex com.tex
execsumm/document.pdf: execsumm/document.tex format.tex com.tex
@@ -9,4 +10,6 @@ clean:
find . -regex ".*\.\(pdf\|log\)" -exec rm -f {} +
view:
open -a Preview execsumm/document.pdf
+plot.png: graph.py
+ ${PYTHON} graph.py img
.PHONY: all clean
diff --git a/execsumm/ExecutiveSummaryDraft.tex b/execsumm/ExecutiveSummaryDraft.tex
deleted file mode 100644
index 498aac9..0000000
--- a/execsumm/ExecutiveSummaryDraft.tex
+++ /dev/null
@@ -1,41 +0,0 @@
-\documentclass{article}
-\usepackage{hyperref}
-\usepackage[scr]{rsfso}
-\def\rload{R_{\rm load}}
-\date{}
-\begin{document}
-\title{Project Executive Summary}
-\author{Holden Rohrer and Nithya Jayakumar}
-
-\maketitle
-\section{Matrix Representation and Homogeneous Solution}
-
-To determine the relevant properties of the linear system, matrix form
-is useful (this form was chosen to reduce fractions' usage):
-\def\x{{\bf x}}
-$$\x' =
-{1\over R_1C_1C_2\rload}
-\pmatrix{0&-C_2\rload &0 \cr
- 0&-C_2(R_1+\rload)&C_1R_1\cr
- 0&C_2R_1 &-C_1R_1} \x +
-{1\over R_1}
-\pmatrix{\omega\cos(\omega t)\cr
- \omega\cos(\omega t)\cr
- 0}
-.$$
-\section{Application of Laplace Transformation}
-We can apply the Laplace Transformation in order to solve this system of differential equations.
-We have the three equations for $x'$, $y'$, and $z'$, and we can take the Laplace Transform of each of these equations"
-$$\mathscr{L}\{x' = \frac{-y}{C_1R_1} + \frac{\omega\cos(\omega t)}{R_1}\} \Rightarrow sX(s) - x(0) = \frac{Y(s)}{C_1R_1} + \frac{\omega s}{R_1(s^2 + \omega^2)}$$
-$$\mathscr{L}\{y' = y\frac{-R_1 - \rload}{R_1C_1\rload} + \frac{z}{C_2\rload} + \frac{\omega\cos(\omega t)}{R_1} \} \Rightarrow sY(s) - y(0) = Y(s)(\frac{-R_1-\rload}{R_1C_1\rload}) + \frac{Z(s)}{C_2\rload} + \frac{\omega s}{R_1(s^2 + \omega^2)}$$
-$$\mathscr{L}\{z' = \frac{y}{C_1\rload} - \frac{z}{C_2\rload} \} \Rightarrow sZ(s) - z(0) = \frac{Y(s)}{C_1\rload} - \frac{Z(s)}{C_2\rload}$$
-
-The last two equations we get can be used to solve for $Z(s)$, which we find to be $$Z(s) = \frac{\omega s(C_1C_2\rload^2)}{(s^2 + \omega^2)(s^2 + s(C_1R_1\rload + R_1C_2\rload + \rload^2C_2) + \rload)}$$
-
-We can now find the partial fraction decomposition of this:
-$$Z(s) = \frac{\omega s(C_1C_2\rload^2)}{(s^2 + \omega^2)(s^2 + s(C_1R_1\rload + R_1C_2\rload + \rload^2C_2) + \rload)} = $$ $$\frac{As + B}{s^2 + \omega^2} + \frac{Cs + D}{(s^2 + \omega^2)(s^2 + s(C_1R_1\rload + R_1C_2\rload + \rload^2C_2) + \rload)} = \omega sC_1C_2\rload^2$$
-To simplify notation, let $b = (s^2 + \omega^2)(s^2 + s(C_1R_1\rload + R_1C_2\rload + \rload^2C_2) + \rload)$
-We find that $$A = \frac{C_1C_2\rload^2\omega (\rload - \omega^2)}{b^2\omega^2 + \rload^2 - 2\rload - 2\rload\omega^2 + \omega^2}$$
-$$B = \frac{bC_1C_2\rload^2\omega^3}{b^2\omega^2 + \rload^2 - 2\rload\omega^2 + \omega^4}$$
-$$C = \frac{-C_1C_2\rload^2\omega(\rload - \omega^2)}{b^2\omega^2 + \rload^2 - 2\rload\omega^2 + \omega^4}$$
-\end{document} \ No newline at end of file
diff --git a/graph.py b/graph.py
index 5c1bbb5..1a32a8a 100644
--- a/graph.py
+++ b/graph.py
@@ -3,9 +3,10 @@
import matplotlib.pyplot as plt
import tkinter
from math import sin,cos,e
+from sys import argv
def f(x):
- return G*sin(x) + B*cos(x) + 2*e**(rer1 * x) * (reE * cos(imr1 * x) - imE * sin(imr1 * x))
+ return G*sin(A*x) + B*cos(B*x) + 2*e**(rer1 * x) * (reE * cos(imr1 * x) - imE * sin(imr1 * x))
for w in range(100,10000,100):
c1 = 2.5*10**(-6)
c2 = 1*10**(-6)
@@ -26,10 +27,10 @@ for w in range(100,10000,100):
D = - b*c1*c2*rload**3*w/(b**2*w**2 + rload**2 - 2*rload*w**2 + w**4) # from https://www.wolframalpha.com/input/?i=solve+for+x1%2Cx2%2Cx3%2Cx4+in+%7B%7B1%2C0%2C1%2C0%7D%2C+%7Bb%2C1%2C0%2C1%7D%2C+%7BR%2C+b%2C+w%5E2%2C+0%7D%2C+%7B0%2C+R%2C+0%2C+w%5E2%7D%7D*%7Bx1%2Cx2%2Cx3%2Cx4%7D+%3D+%7B0%2C0%2Cw*c_1*c_2*R%5E2%2C0%7D and an insane partial fraction decomposition
E = (D-C*r1)/(r2-r1)
F = C - E # Another PFD of Cs-D/(as^2+bs+c)
- G = B/w
+ G = A/w
# Final solution should be
- # Gsin(theta) + Bcos(theta) + Ee^(r1 t) + Fe^(r2 t)
+ # Gsin(A * theta) + Bcos(B * theta) + Ee^(r1 t) + Fe^(r2 t)
# But E, F, r1, and r2 are complex. Luckily, conjugates make it that
# = 2e^(Re(r1) t) ( Re(E)cos(Im(r1)t) - Im(E)sin(Im(r1)t) )
rer1 = r2.real
@@ -37,7 +38,7 @@ for w in range(100,10000,100):
imr1 = r2.imag
imE = F.imag # switched because positive ones were needed
- print("%.2E * sin(t) + %.2E * cos(t) + 2e^(%.2f t) (%.2E cos(%.2f t) - %.2E sin(%.2f t))" % (G, B, rer1, reE, imr1, imE, imr1))
+ print("%.2E * sin(%.2E t) + %.2E * cos(%.2E t) + 2e^(%.2f t) (%.2E cos(%.2f t) - %.2E sin(%.2f t))" % (G, A, B, B, rer1, reE, imr1, imE, imr1))
x = []
y = []
@@ -46,4 +47,7 @@ for w in range(100,10000,100):
y.append(f(i/100))
plt.plot(x,y)
-plt.show()
+if len(argv) > 1 and argv[1] == 'img':
+ plt.savefig('plot.png')
+else:
+ plt.show()