Solving a Simple Drug Delivery Model Using Analytical, Linear Algebra, and Numeric Approaches
Summary
Learning Goals
- Students will learn how a system of first-order differential equations can be treated as a system of linear equations
- Students will see how numerical solutions compare against
- MATLAB's symbolic toolbox is used to find and plot the analytical solution to the system
- MATLAB's built-in matrix solvers and Runge-Kutta algorithms are used to numerically approximate the behavior of the system, and then compare their results against the exact solutions produced by the other two methods.
- In addition to learning MATLAB syntax, students are asked to extrapolate the procedures introduced in the lab to explore how they can incorporate discontinuous input functions to the model and its solution
Context for Use
Description and Teaching Materials
The activity is a guided walk through of the problem setup and solution approaches for a three-compartment drug-delivery model. The MATLAB Live Script includes the detailed symbolic analytical solution to the drug-delivery problem, and a list of general steps required to solve similar problems. Furthermore, students can complete a series of short activities to get practice with the MATLAB syntax and commands required to solve systems of nonhomogeneous ODEs using three separate approaches:
- A linear systems approach employing Eigenvectors and Eigenvalues
- A symbolic approach utilizing MATLAB's symbolic toolbox
- A numerical approach using MATLAB's Runge-Kutta solver, ode45
At the end of each section in the Live Script, students can complete a series of MATLAB grader problems that provide them with a template that contains the outline of the code structure required to solve the Drug Delivery problem using the three approaches explored in the lab.
MATLAB Live Script of Activities: Drug_Delivery_Problem.mlx (MATLAB Live Script 48kB Nov7 19)
Solution to MATLAB Live Script Activities: Drug_Delivery_Problem_Solution.mlx (MATLAB Live Script 518kB Nov7 19)
Teaching Notes and Tips
Assessment
The output plots generated by the students as part of the post-lab activities can be compared against the solutions to see whether they were able to complete the assignment. I typically provide the students with the solution to the in-lab activities a few days after the lab period (prior to the assignment being due) so they can compare their code get help on areas where they are stuck before attempting the post-lab.
MATLAB Grader Problems:
References and Resources
MATLAB Documentation for key commands used in the Activity
- https://www.mathworks.com/help/matlab/ref/eig.htmls
- https://www.mathworks.com/help/matlab/ref/diag.html
- https://www.mathworks.com/help/matlab/ref/mldivide.html?searchHighlight=mldivide&s_tid=doc_srchtitle
- https://www.mathworks.com/help/matlab/ref/eye.html
- https://www.mathworks.com/help/symbolic/syms.html
- https://www.mathworks.com/help/matlab/ref/diff.html?searchHighlight=diff&s_tid=doc_srchtitle
- https://www.mathworks.com/help/symbolic/dsolve.html?searchHighlight=dsolve&s_tid=doc_srchtitle
- https://www.mathworks.com/help/symbolic/subs.html#d117e213314
- https://www.mathworks.com/help/symbolic/heaviside.html
- https://www.mathworks.com/help/symbolic/dirac.html
- https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html
- https://www.mathworks.com/help/matlab/ref/ode45.html