フィルターのクリア

Second Order Laplace solving doesn't work ('Unable to find explicit solution')

34 ビュー (過去 30 日間)
Matteo Millone
Matteo Millone 2024 年 8 月 13 日 9:45
コメント済み: Matteo Millone 2024 年 8 月 13 日 19:54
I'm trying to solve an ODE using Laplace method, but I'm stuck on solving the equation
Here's my code:
syms t x(t) s X(s);
% PARAMETERS (tried to do symbolically but it was more diffcult)
m = 1;
k = 0.5;
xi = 1.2;
c = xi*2*sqrt(k*m)
c = 1.6971
f0 = 1;
w = 0.1;
dx = diff(x, t, 1);
ddx = diff(x, t, 2);
% INITIAL CONDITIONS
x0 = 0;
dx0 = 0;
newton = m*ddx+ c*dx +k*x;
f = f0*cos(w*t);
lteqn = laplace(newton, t, s)
lteqn = 
lefteqn = subs(lteqn,{laplace(x(t), t, s), x(0),dx(0)},{X(s), x0, dx0})
lefteqn = 
F_s = laplace(f, t, s);
simplify(solve(lefteqn == F_s, X(s)))
Warning: Unable to find explicit solution. For options, see help.
ans = Empty sym: 0-by-1
I can't believe MATLAB cannot solve this easy equation. I think I'm missing something.
Thank you guys

採用された回答

Aquatris
Aquatris 2024 年 8 月 13 日 10:21
編集済み: Aquatris 2024 年 8 月 13 日 10:21
Not sure the underlying reason behind it but you are defining the X as a function of s and solve function seems to be having trouble solving it. Define X as a standalone and it has no trouble
syms t x(t) s X;
% PARAMETERS (tried to do symbolically but it was more diffcult)
m = 1;
k = 0.5;
xi = 1.2;
c = xi*2*sqrt(k*m)
c = 1.6971
f0 = 1;
w = 0.1;
dx = diff(x, t, 1);
ddx = diff(x, t, 2);
% INITIAL CONDITIONS
x0 = 0;
dx0 = 0;
newton = m*ddx+ c*dx +k*x;
f = f0*cos(w*t);
lteqn = laplace(newton, t, s);
lefteqn = subs(lteqn,{laplace(x(t), t, s), x(0),dx(0)},{X, x0, dx0});
F_s = laplace(f, t, s);
simplify(solve(lefteqn == F_s, X))
ans = 

その他の回答 (1 件)

Sam Chak
Sam Chak 2024 年 8 月 13 日 11:03
Do you want to analytically solve the ODE like this?
syms s t X
%% original parameters
m = 1;
k = 0.5;
xi = 1.2;
c = xi*2*sqrt(k*m);
f0 = 1;
w = 0.1;
%% Test parameters -> should return x(t) = 1/2·(sin(t) - t·e^(-t))
% m = 1;
% k = 1;
% xi = 1;
% c = xi*2*sqrt(k*m);
% f0 = 1;
% w = 1;
%% Main
eqn = m*s^2*X + c*s*X + k*X == laplace(f0*cos(w*t), t, s);
X = solve(eqn, X);
x = ilaplace(X, s, t)
x = 
  1 件のコメント
Matteo Millone
Matteo Millone 2024 年 8 月 13 日 19:54
Thanks a lot, anyway i need the solution function of s, i have to draw Bode diagram

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

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by