can you please help me solve this diffetential equation system?

조회 수: 1 (최근 30일)
SOUGLES STAMATIS
SOUGLES STAMATIS 2021년 4월 7일
댓글: Alan Stevens 2021년 4월 8일
I need to solve a differential system and I coded in this way . I doesn't seem to work. I want to solve it only for t [0,4]. how can i do that?
syms x1(t) x2(t) x3(t) x4(t) x5(t) x6(t)
b=4.2030*10^5
m=1.0508*10^6
k=3.5025*10^9
A = [-2*b/(3*m) b/(3*m) 0 1/(3*m) -1/(3*m) 0 ;
b/(2*m) -2*b/(2*m) b/(2*m) 0 1/(3*m) -1/(3*m) ;
0 b/m -b/m 0 0 1/m ;
-k 0 0 0 0 0 ;
k -k 0 0 0 0 ;
0 k -k 0 0 0];
B = [-b/(3*m)*(1.8747*log(t)+8.6905);
0;
0;
-k*(1.8747*log(t)+8.6905);
0;
0;];
Y = [x1; x2; x3; x4; x5; x6];
odes = diff(Y) == A*Y + B
C = Y(0) == [0;0;0;0;0;0];
[x1Sol(t), x2Sol(t), x3Sol(t), x4Sol(t), x5Sol(t), x6Sol(t)] = dsolve(odes,C);
x1Sol(t) = simplify(x1Sol(t))
x2Sol(t) = simplify(x2Sol(t))
x3Sol(t) = simplify(x3Sol(t))
x4Sol(t) = simplify(x4Sol(t))
x5Sol(t) = simplify(x5Sol(t))
x6Sol(t) = simplify(x6Sol(t))

답변 (1개)

Alan Stevens
Alan Stevens 2021년 4월 7일
You have log(t) in the definition of B. This causes problems at t = 0.
  댓글 수: 2
SOUGLES STAMATIS
SOUGLES STAMATIS 2021년 4월 7일
okey, how can set the t value from 0.1 to 4?
Alan Stevens
Alan Stevens 2021년 4월 8일
Like this
x0 = [0;0;0;0;0;0];
tspan = [0.01 4];
[t, x] = ode45(@bc, tspan, x0);
plot(t,x),grid
function xdot = bc(t,x)
b=4.2030*10^5;
m=1.0508*10^6;
k=3.5025*10^9;
A = [-2*b/(3*m) b/(3*m) 0 1/(3*m) -1/(3*m) 0 ;
b/(2*m) -2*b/(2*m) b/(2*m) 0 1/(3*m) -1/(3*m) ;
0 b/m -b/m 0 0 1/m ;
-k 0 0 0 0 0 ;
k -k 0 0 0 0 ;
0 k -k 0 0 0];
B = [-b/(3*m)*(1.8747*log(t)+8.6905);
0;
0;
-k*(1.8747*log(t)+8.6905);
0;
0;];
xdot = A*x + B;
end
You might need to plot the different x's on separate graphs to see them all properly.
Note that the results will be somewhat different depending on your starting value for t.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by