# Why Matlab could not solve a set of linear differential equations with initial conditions through dsolve?

5 views (last 30 days)
Mehdi on 12 Nov 2022
Edited: Torsten on 12 Nov 2022
Hi,
Where is the problem in my codes to solve a set of linear differential equations with initial conditions?
Any suggest?
clc
clear
ML = [2.53735261480440e-10 -1.35406667270221e-16 1.30871725825994e-18 -2.13374675288863e-15 2.03261768716403e-17 -1.61477754970584e-16 -1.62541250675724e-16;
-1.35406667270221e-16 2.53734628229043e-10 -2.73582082145325e-17 4.72489571641653e-16 1.92706132643316e-16 8.27766626176449e-16 -4.33522241607763e-16;
1.30871725825994e-18 -2.73582082145325e-17 2.53811694377620e-10 -1.38664722187494e-14 1.89471206077083e-13 -5.47669811839268e-14 2.67184290813528e-14;
-2.13374675288863e-15 4.72489571641653e-16 -1.38664722187494e-14 2.53715763347126e-10 -6.05035598297774e-15 -2.32344311157266e-14 2.96103830935012e-14;
2.03261768716403e-17 1.92706132643316e-16 1.89471206077083e-13 -6.05035598297774e-15 2.53850804700165e-10 -6.82222668978547e-14 4.82767908961758e-14;
-1.61477754970584e-16 8.27766626176449e-16 -5.47669811839268e-14 -2.32344311157266e-14 -6.82222668978547e-14 2.53705685445938e-10 3.43519159646703e-14;
-1.62541250675724e-16 -4.33522241607763e-16 2.67184290813528e-14 2.96103830935012e-14 4.82767908961758e-14 3.43519159646703e-14 2.53690028388901e-10];
KL = [6.34368385323866e-05 -5.80205835437760e-08 -1.23764005930491e-10 -1.48354797737571e-07 -3.76339592244736e-08 -1.55516201961077e-07 -2.99714848304693e-07;
-5.80205835437760e-08 0.00277423390772568 -3.64032926965371e-10 -1.15677999366471e-06 -5.05159524190059e-07 -1.14803879509422e-06 -2.36449328010142e-06;
-1.23764005930491e-10 -3.64032926965371e-10 0.00351253253565176 2.60553493225360e-07 -2.50880577858935e-05 8.96289108975872e-06 2.53253964466067e-07;
-1.48354797737571e-07 -1.15677999366471e-06 2.60553493225360e-07 0.0201021660593748 -0.000292315163965329 0.000101788069022335 -6.31134009698694e-06;
-3.76339592244736e-08 -5.05159524190059e-07 -2.50880577858935e-05 -0.000292315163965329 0.0414826409114255 0.00570625287068793 0.00236501515779697;
-1.55516201961077e-07 -1.14803879509422e-06 8.96289108975872e-06 0.000101788069022335 0.00570625287068793 0.0634851951853710 -0.000910774592712826;
-2.99714848304693e-07 -2.36449328010142e-06 2.53253964466067e-07 -6.31134009698694e-06 0.00236501515779697 -0.000910774592712826 0.121679411312940];
F=[0.000289760052925726;
0.000537710491736623;
1.24507643858810e-08;
-0.000328931258625777;
-4.51634984307082e-05;
-0.000110003762488177;
-0.000505551160254736];
syms tau_1(t) tau_2(t) tau_3(t) tau_4(t) tau_5(t) tau_6(t) tau_7(t)
v = transpose([tau_1 tau_2 tau_3 tau_4 tau_5 tau_6 tau_7]);
odes = diff(diff(v)) == -inv(ML) * KL * v;
C = [v(0) == double(0*inv(ML) * [F]) , diff(v(0)) == double(01*inv(ML) * [F])];
dsolve(odes,C)

Torsten on 12 Nov 2022
Edited: Torsten on 12 Nov 2022
The eigenvalues of a polynomial of degree 14 (=degree of ODEs * number of ODEs) are required to get an analytical solution for your problem. But analytical formulae for roots of polynomials only exist up to degree 4.
Torsten on 12 Nov 2022
Edited: Torsten on 12 Nov 2022
ML = [2.53735261480440e-10 -1.35406667270221e-16 1.30871725825994e-18 -2.13374675288863e-15 2.03261768716403e-17 -1.61477754970584e-16 -1.62541250675724e-16;
-1.35406667270221e-16 2.53734628229043e-10 -2.73582082145325e-17 4.72489571641653e-16 1.92706132643316e-16 8.27766626176449e-16 -4.33522241607763e-16;
1.30871725825994e-18 -2.73582082145325e-17 2.53811694377620e-10 -1.38664722187494e-14 1.89471206077083e-13 -5.47669811839268e-14 2.67184290813528e-14;
-2.13374675288863e-15 4.72489571641653e-16 -1.38664722187494e-14 2.53715763347126e-10 -6.05035598297774e-15 -2.32344311157266e-14 2.96103830935012e-14;
2.03261768716403e-17 1.92706132643316e-16 1.89471206077083e-13 -6.05035598297774e-15 2.53850804700165e-10 -6.82222668978547e-14 4.82767908961758e-14;
-1.61477754970584e-16 8.27766626176449e-16 -5.47669811839268e-14 -2.32344311157266e-14 -6.82222668978547e-14 2.53705685445938e-10 3.43519159646703e-14;
-1.62541250675724e-16 -4.33522241607763e-16 2.67184290813528e-14 2.96103830935012e-14 4.82767908961758e-14 3.43519159646703e-14 2.53690028388901e-10];
KL = [6.34368385323866e-05 -5.80205835437760e-08 -1.23764005930491e-10 -1.48354797737571e-07 -3.76339592244736e-08 -1.55516201961077e-07 -2.99714848304693e-07;
-5.80205835437760e-08 0.00277423390772568 -3.64032926965371e-10 -1.15677999366471e-06 -5.05159524190059e-07 -1.14803879509422e-06 -2.36449328010142e-06;
-1.23764005930491e-10 -3.64032926965371e-10 0.00351253253565176 2.60553493225360e-07 -2.50880577858935e-05 8.96289108975872e-06 2.53253964466067e-07;
-1.48354797737571e-07 -1.15677999366471e-06 2.60553493225360e-07 0.0201021660593748 -0.000292315163965329 0.000101788069022335 -6.31134009698694e-06;
-3.76339592244736e-08 -5.05159524190059e-07 -2.50880577858935e-05 -0.000292315163965329 0.0414826409114255 0.00570625287068793 0.00236501515779697;
-1.55516201961077e-07 -1.14803879509422e-06 8.96289108975872e-06 0.000101788069022335 0.00570625287068793 0.0634851951853710 -0.000910774592712826;
-2.99714848304693e-07 -2.36449328010142e-06 2.53253964466067e-07 -6.31134009698694e-06 0.00236501515779697 -0.000910774592712826 0.121679411312940];
F=[0.000289760052925726;
0.000537710491736623;
1.24507643858810e-08;
-0.000328931258625777;
-4.51634984307082e-05;
-0.000110003762488177;
-0.000505551160254736];
ML_invers = inv(ML);
fun = @(t,v)[v(8:14);-ML_invers * KL * v(1:7)];
v0 = [0*ML_invers * F;1*ML_invers * F];
[T,V] = ode15s(fun,[0 0.015],v0);
plot(T,V(:,1))

### Categories

Find more on Mathematics in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by