Solving system of first order linear differential equations

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

posting the datas of your equation would help

Sign in to comment.

Answers (1)

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.

Asked:

on 20 Dec 2018

Answered:

on 20 Dec 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!