summaryrefslogtreecommitdiffstats
path: root/notes
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2014-04-14 23:04:35 -0400
committerbnewbold <bnewbold@robocracy.org>2014-04-14 23:04:35 -0400
commit5e44b66d9bb47739ab4ccb068b867b2f2332846c (patch)
treede9608f42a4716c7bb753e72d5c6f4be5f9ed23b /notes
parent19e5165e4ac588138807021e859e7ab1de698672 (diff)
downloaddmmsb2014-5e44b66d9bb47739ab4ccb068b867b2f2332846c.tar.gz
dmmsb2014-5e44b66d9bb47739ab4ccb068b867b2f2332846c.zip
lec07 notes
Diffstat (limited to 'notes')
-rw-r--r--notes/lec07_intro2_eulers46
1 files changed, 46 insertions, 0 deletions
diff --git a/notes/lec07_intro2_eulers b/notes/lec07_intro2_eulers
new file mode 100644
index 0000000..17630d2
--- /dev/null
+++ b/notes/lec07_intro2_eulers
@@ -0,0 +1,46 @@
+
+euler's method:
+
+dx/dt =~ ( x(t + Dt) - x(t) ) / Dt, for very small Dt
+
+so, x(t + Dt) = x(t) + f(x) * Dt, which is how to integrate the system
+
+"if Dt is too large, becomes highly unstable" (duh)
+
+scary MATLAB advice:
+- watch out of totally crazy values (very high)
+- non-negative values go negative
+
+MATLAB built-in ODE solvers: ode23, ode15s
+
+runge-kutta (use dxdt from between t_n and t_(n+1) )
+variable time-step methods
+
+summary: Euler's method sucks, news at 11.
+
+### misc julia notes
+
+the only place to find history (?!?!!) is in ~/.julia_history
+
+### codes
+
+using Winston
+
+a=20
+b=2
+c=5
+dt = 0.05
+tlast = 2
+
+iterations = int( round(tlast/dt) )
+xall = zeros(iterations, 1)
+x = c
+
+for i = 1:iterations
+ xall[i] = x
+ dxdt = a - b*x
+ x = x + dxdt*dt
+end
+
+time = dt * [0:iterations-1]'
+plot(time,xall)