subs D(x)(0)

10 ビュー (過去 30 日間)
zakaria bouzouf
zakaria bouzouf 2016 年 10 月 30 日
コメント済み: Star Strider 2016 年 11 月 1 日
Hello (sorry for my bad english)
I have a porblem when i want to remplace D(x)(0) with a expression (Xm*sin(w*t+omega) I need it to solve a differentiel equation using Laplace (I must use Laplace for the resolution)* When a use FL=subs(FL,diff(x(t),t),Xm*sin(w*t+omega)) i get the same expression and if a use s instead of t FL=subs(FL,diff(x(t),s),Xm*sin(w*t+omega)) i get D(x)(Xm*sin(w*t+omega) FL is the fuction i get after the transformation of Laplace
Please i need the responce as soon as possible
  2 件のコメント
Star Strider
Star Strider 2016 年 10 月 30 日
Please post your original differential equation, and describe what you want to do.
zakaria bouzouf
zakaria bouzouf 2016 年 10 月 30 日
編集済み: zakaria bouzouf 2016 年 10 月 30 日
with x(0)=Xm*cos(tetta) and x'(0)=-Xm*w*sin(tetta)

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

採用された回答

Star Strider
Star Strider 2016 年 10 月 30 日
編集済み: Star Strider 2016 年 10 月 30 日
This works (although it uses a soon-to-be-deprecated single-quotes syntax in the subs call):
syms omega omega0 s x(t) Xm tetta
DE = diff(x,2) + omega0^2*x == 0;
LDE = laplace(DE, t, s);
LDE = subs(LDE, {'x(0)', 'D(x)(0)'}, {Xm*cos(tetta), -Xm*omega*sin(tetta)});
LDE = simplify(LDE, 'Steps', 20)
LDE =
omega0^2*laplace(x(t), t, s) + s^2*laplace(x(t), t, s) + Xm*omega*sin(tetta) == Xm*s*cos(tetta)
I usually work with control problems, where initial conditions are by convention zero. It is possible with the dsolve function to include specific initial conditions in the differential equation to be integrated. For some reason, similarly including initial conditions in laplace arguments is not possible.
I consider the inability to include initial conditions in a laplace call to be a ‘bug’ that needs to be corrected.
EDIT I submitted an Enhancement Request that the syntax for including initial conditions in the arguments be the same for both the dsolve and laplace functions. Let’s hope!
  10 件のコメント
Karan Gill
Karan Gill 2016 年 11 月 1 日
編集済み: Karan Gill 2016 年 11 月 1 日
One doesn't need to use single-quote syntax for "subs". Try
Dxt = diff(x,t);
LDE = subs(LDE, {x(0) Dxt(0)}, {Xm*cos(tetta) -Xm*omega*sin(tetta)})
Besides the substitution, could you explain why using Laplace transforms is harder now? That would be really helpful to know.
Karan (Symbolic Math documentation)
Star Strider
Star Strider 2016 年 11 月 1 日
I didn’t use the syntax you did. That may have been part of the problem.
The other problem I had was in solving the Laplace-domain equation for ‘x(t)’:
LDE = subs(LDE, {'x(0)', 'D(x)(0)','laplace(x(t), t, s)'}, {X0, DX0, X}); % Substitute
For whatever reason, I found that third substitution (where ‘X’ is actually ‘X(s)’) necessary in order to actually solve the equation.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by