Solving coupled ODE symbolically

3 ビュー (過去 30 日間)
saravanakumar D
saravanakumar D 2021 年 12 月 25 日
コメント済み: saravanakumar D 2021 年 12 月 26 日
I need to solve this coupled ODE through laplace transform.
My algorithm
  1. I have written the 2nd order ODE in matrix form.
  2. Took laplace transform
  3. Substituted the initial conditions. (Help Needed: Could not substitute diff(x1(0)) and diff(x2(0)) as zero.
  4. Solve the linear equation (Help Needed: Don't know what to do)
I have attached my code.
syms t s x1(t) x2(t) m1 m2 c1 c2 k1 k2 k_c c_c Delta_m f1 f2 omega f_0
M=[m1 0;0 m2]
M = 
C=[c1+c_c -c_c;-c_c c2+c_c]
C = 
K=[k1+k_c -k_c;-k_c k2+k_c]
K = 
F=[f1;f2]
F = 
X=[x1;x2]
X(t) = 
equ=M*diff(X,t,2)+C*diff(X,t)+K*X==F
equ(t) = 
equ=subs(equ,[f1,f2],[f_0*cos(omega*t),0])
equ(t) = 
L1=laplace(equ)
L1 = 
L2=subs(L1,[x1(0),x2(0),diff(x1(0),t,1),diff(x2(0),t,1)],[0 0 0 0]) %Substituting Zero Initial Condition
L2 = 
% In above step the time derivative has to be zero, but it is not.
Sol=solve(L2,[laplace(x1) laplace(x2)])
Error using sym.getEqnsVars>checkVariables (line 98)
Second argument must be a vector of symbolic variables.

Error in sym.getEqnsVars (line 62)
checkVariables(vars);

Error in sym/solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});

Error in sym/solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 25 日
syms t s x1(t) x2(t) m1 m2 c1 c2 k1 k2 k_c c_c Delta_m f1 f2 omega f_0
M=[m1 0;0 m2]
M = 
C=[c1+c_c -c_c;-c_c c2+c_c]
C = 
K=[k1+k_c -k_c;-k_c k2+k_c]
K = 
F=[f1;f2]
F = 
X=[x1;x2]
X(t) = 
equ=M*diff(X,t,2)+C*diff(X,t)+K*X==F
equ(t) = 
equ=subs(equ,[f1,f2],[f_0*cos(omega*t),0])
equ(t) = 
L1=laplace(equ)
L1 = 
dx1 = diff(x1)
dx1(t) = 
dx2 = diff(x2)
dx2(t) = 
lap1 = laplace(x1)
lap1 = 
lap2 = laplace(x2)
lap2 = 
syms LAP1 LAP2
L2 = subs(L1, {x1(0), x2(0), dx1(0), dx2(0), lap1, lap2}, {0, 0, 0, 0, LAP1, LAP2}) %Substituting Zero Initial Condition
L2 = 
Sol = solve(L2, [LAP1, LAP2])
Sol = struct with fields:
LAP1: (f_0*s*(k2 + k_c + c2*s + c_c*s + m2*s^2))/((omega^2 + s^2)*(k1*k2 + k1*k_c + k2*k_c + c1*m2*s^3 + c2*m1*s^3 + c_c*m1*s^3 + c_c*m2*s^3 + k1*m2*s^2 + k2*m1*s^2 + k_c*m1*s^2 + k_c*m2*s^2 + m1*m2*s^4 + c1*k2*s + c2*k1*s + c1*k_c*s + c_c*k1*s + … LAP2: (f_0*s*(k_c + c_c*s))/((omega^2 + s^2)*(k1*k2 + k1*k_c + k2*k_c + c1*m2*s^3 + c2*m1*s^3 + c_c*m1*s^3 + c_c*m2*s^3 + k1*m2*s^2 + k2*m1*s^2 + k_c*m1*s^2 + k_c*m2*s^2 + m1*m2*s^4 + c1*k2*s + c2*k1*s + c1*k_c*s + c_c*k1*s + c2*k_c*s + c_c*k2*s +…
LAP1s = simplify(Sol.LAP1)
LAP1s = 
LAP2s = simplify(Sol.LAP2)
LAP2s = 
%iLap1 = ilaplace(LAP1s)
%iLap2 = ilaplace(LAP2s)
The ilaplace() take longer than this demonstration facility allows
  1 件のコメント
saravanakumar D
saravanakumar D 2021 年 12 月 26 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by