How to specify boundary conditions for solution of ODes

4 ビュー (過去 30 日間)
saheed
saheed 2014 年 9 月 18 日
コメント済み: saheed 2014 年 9 月 18 日
Hi everyone,
How can I specify boundary conditions in a matrix to solve the ODE system with the following dsolve command syntax?
syms x1(t) x2(t).....xN(t)
A = [a1 a2....aN; b1 b2...bN;...;d1 d2....dN];
B = [t1; t2;...;tN];
Y = [x1; x2;...;xN];
S = dsolve(diff(Y) == A*Y + B);

回答 (1 件)

Mischa Kim
Mischa Kim 2014 年 9 月 18 日
編集済み: Mischa Kim 2014 年 9 月 18 日
saheed, see e.g.
syms R L C Uc(t)
% Define first and second derivatives for Uc
DUcDt = diff(Uc);
D2UcDt2 = diff(Uc,2);
% Perturbation input (or RHS): change input to dirac(t), t, etc.
Uin = 1;
% Define differential equation for linear RLC circuit
RLC_DE = L*C*D2UcDt2 + R*C*DUcDt + Uc == Uin;
% Set initial conditions
Uc0 = Uc(0) == 0;
DUc0 = DUcDt(0) == 0;
% Solve differential equation and display
Uc_sym = dsolve(RLC_DE, Uc0, DUc0);
display(['Uc(t) = ',char(10),char(Uc_sym),char(10)])
Alternatively, check out this example in the documentation.
  1 件のコメント
saheed
saheed 2014 年 9 月 18 日
Thanks Kim but actually I have tried this syntax you specified but I got error because I need to specify the differential terms A, Y and B in
S = dsolve(diff(Y) == A*Y + B);
as matrices and vectors respectively. So the problem still remains if I specify the conditions of [x1; x2;...;xN] in
Y = [x1; x2;...;xN];
as x1(0)==0, x2(0)==0
just like you suggested. Any further suggestion is highly welcomed.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by