Solving system of first order linear differential equations
Show older comments
I wanted to solve a system of first order linear differential equations in MATLAB. Expressed in terms of matrices, the equation is of the form
. In this equation, the matrix C is a constant matrix which can be determined from the user input. So the solution to this equation if of the form
for each eigenvalue
of the matrix, and its corresponding eigenvector
. My aim is to plot the dependent variables in the system as functions of time.
So I know the command eig to get the eigenvalues and corresponding eigenvectors. After getting these, how do I express the set of variables
as per the equation above. Assume that the constants
can be determined from initial conditions.
Note: I also saw that ode45 can be used in this case, but I wanted to learn how to express the equation using symbols in MATLAB. Any help will be appreciated. TIA
1 Comment
madhan ravi
on 20 Dec 2018
Edited: madhan ravi
on 20 Dec 2018
posting the datas of your equation would help
Answers (1)
Star Strider
on 20 Dec 2018
0 votes
You can use the numeric solvers if that works for you. It may be easier to use the expm (link) function for a linear problem such as this. Don’t worry about the eigenvalues — expm has already implemented the Cayley-Hamilton Theorem for you with respect to the matrix exponential.
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!