Introduction to Scientific Computing : Lecture 27 codes
Ballistics example
Computational routines
fball.m
-- right hand side for an ODE for the ballistics problem with drag.
hitground.m
-- event function to indicate when a projectile hit the ground.
ftarget.m
-- evaluate the impact distance for different targeting angles.
find_anglec.m
-- do root-finding on a Chebyshev interpolant to compute angles for hitting a target at a specified distance.
Demo drivers
balldefault.m
-- set up default physical parameters for an example ballistics problem.
testball1.m
-- basic sanity check of the ballistics ODE right-hand side function.
testball2.m
-- basic check of the use of the Events option in ode45.
testball3.m
-- check the accuracy of low-order Chebyshev interpolation to estimate the angle-distance curve.
testball4.m
-- check the computation of targeting angles via Chebyshev interpolation of the angle-distance curve.
Particle-in-box example
Computational routines
particlebox.m
-- compute the first four energy levels for the "particle in a box" model using second-order finite differences.
particleboxc.m
-- compute the first four energy levels for the "particle in a box" model using a Chebyshev collocation scheme.
Demo drivers
particlebox_cvg.m
-- illustrate the convergence of the energy levels for the "particle in a box" model using second-order finite differences.
particleboxc_cvg.m
-- illustrate the convergence of the energy levels for the "particle in a box" model using Chebyshev collocation.
Support routines
cheb.m
-- compute Chebyshev points and differentiation matrix
chebeval.m
-- evaluate a Chebyshev interpolant by barycentric interpolation. See Trefethen's
Approximation Theory and Approximation Practice
for details.
chebopt.m
-- find local maxima of a Chebyshev interpolant via a not-very-smart Newton iteration
Home
Syllabus
Lectures
Assignments
David Bindel
lastname at cs.cornell.edu
Last modified 2012-05-01