Solving Matrix Differential Equations; Coding help
Ältere Kommentare anzeigen
I have an assignment to solve differential equations in matrices. I am almost finished with the assignment but I'm having trouble figuring out how to code the last bit of the assignment. In short, we are to find the general solution to an initial value problem, with the general solution being:
With the initial condition being:
Where λ are the real eigenvalues and
are the eigenfunctions of our initial matrix A. I am currently stuck on the part of trying to determine c, the weights. For one of our examples (the one I am testing out) the initial matrix A is given as [1 1; 1 1] and our initial condition is given as x0 = [1;2].
In our instructions, we are told to create a matrix E with the columns of the matrix forming an eigenfunction basis for the set. I have done this substituting lambda with its respective eigenvalue, now all I need to do is find the weights for the given condition. I have done it by hand and I should get that the weight c1 = 1/2 and c2 = 3/2 but I cannot figure out how to code this in matlab. I've tried using dsolve but I get errors. Here is the resultant E vector, along with our initial condition and the A matrix:
syms exp(t)
E =
[ -1, exp(t)^(2*t)]
[ 1, exp(t)^(2*t)]
%Initial Matrix was
A = ones(2);
%Initial condition is:
x0 = [1;2];
So my question is, how do I write the code to solve this system of equations? As stated earlier, I've done it by hand and got that c1 = 1/2 and c2 = 3/2 but I'm not sure how to code this as I have been getting errors. Can anyone help me out? Specifically, I'm having trouble telling matlab that when it solves t should be 0 (meaning the exponentials should equal 1 since e^0 = 1) and solving for the weights.
Antworten (0)
Kategorien
Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!