MATLAB: Finding particular solution to 3×3 matrix using undetermined coefficients

3x3 matrixundetermined coefficients

Hi all,
I am trying to find the particular solution to the following system of equations:
function xprime = A(t,x)
eqn1 = - x(1)*(15/4) == -1575;
eqn2 = (15/4)*x(1) - (5/12)*x(2);
eqn3 = (5/12)*x(2) - (5/14)*x(3);
Below I went about finding my general solution:
end
A = sym([-15/4,0,0;15/4,-5/12,0;0,5/12,-5/14]);
>> Id3 = sym([1,0,0;0,1,0;0,0,1]);
>> syms lambda
>> B = lambda*Id3 - A
B =
[ lambda + 15/4, 0, 0]
[ -15/4, lambda + 5/12, 0]
[ 0, -5/12, lambda + 5/14]
>> p=det(B)
p =
lambda^3 + (95*lambda^2)/21 + (1025*lambda)/336 + 125/224
>> evs = solve(p)
evs =
-15/4
-5/12
-5/14
>> null(evs(1)*Id3-A)
ans =
152/21
-57/7
1
And now, since the system is non-homogenous…this would give me
[0,0,0] = [(-15/4), 0, 0 ; (15/4), (-5/12), 0 ; 0, (5/12) , (-5/14)] x [a1, b1, c1] + [1575, 0, 0]
This results in the numbers that I was looking for…. Xp: 420, 3780, 4410.
My question is…how can I go about this above equation by way of undetermined coefficients in matlab?
Thanks for any advice you have

Best Answer

Read about fsolve():
Roots=vpa(fsolve(@solls,[0;0;0])) %function call
function eqn=solls(x) %function definition
eqn(1) = - x(1)*(15/4) + 1575;
eqn(2) = (15/4)*x(1) - (5/12)*x(2);
eqn(3) = (5/12)*x(2) - (5/14)*x(3);
end