Matlab/Octave Codes
from lecture
- heat.m solves time-dependent heat equation in 1D
- heattogif.m animates heat.m result to give this GIF
- steadyheat.m solves u’‘(x) = f(x) with Dirichlet boundary conditions
- verifysh.m generates this convergence figure
- bothneumann.m solves u’‘(x) = f(x) with Neumann boundary conditions
- heat2d.m solves u_xx + u_yy = f on a square, with mixed boundary conditions
- testheat2d calls heat2d.m to demonstrate convergence
- eulerboth.m generates 3 figures for different step sizes k: k=1 and k=0.5,0.2 and k=0.1,0.05
- taylor2.m Taylor O(k^2) method; generates this figure
- rungekutta.m compare O(k^1), O(k^2), and O(k^4) Runge-Kutta methods; generates this figure
- stepsizes.m show time step sizes generated by Matlab’s adaptive and embedded Runge-Kutta methods ode23 and ode45; Octave generates this expected figure while Matlab generates this weird result
- heatblackbox.m advertise MOL approach to heat equation PDE with this short code which calls
ode23
; generates this figure - refinestable.py [Python] generates
.png
figures showing conditional stability for FTCS on the heat equation; here are the figures rolled into an animated.gif
- advecttry.m try FTCS and Lax-Friedrichs on u_t + a u_x = 0 with square-wave initial condition
- advectcompare.m compare 4 schemes (Lax-Friedrichs, upwind, leapfrog, Lax-Wendroff) on u_t + a u_x = 0 with square-wave initial condition; generates this figure
from homework solutions
From Assignment #1:
From Assignment #2:
From Assignment #3:
From Assignment #4:
From Assignment #5:
From Assignment #6:
From Assignment #7:
From Assignment #8:
From Assignment #9: