How do i set the initial values in a subs function?

10 ビュー (過去 30 日間)
Birger Venås
Birger Venås 2016 年 12 月 15 日
syms c1 c2 k1 k2 m
syms x(t) y(t) s
x_prikk = diff(x(t),t);
x_prikk_prikk = diff(x_prikk,t);
y_prikk = diff(y(t),t);
eq = c2*(y_prikk-x_prikk)-k2*(y-x)-c1*x_prikk-k1*x-m*x_prikk_prikk;
this gives me
eq_s =
k2*(laplace(x(t), t, s) - laplace(y(t), t, s)) - k1*laplace(x(t), t, s) + c2*(x(0) - y(0) - s*laplace(x(t), t, s) + s*laplace(y(t), t, s)) + m*(D(x)(0) + s*x(0) - s^2*laplace(x(t), t, s)) + c1*(x(0) - s*laplace(x(t), t, s))
I'm then aible to set: eq_s_0 = subs(eq_s, {x(0),y(0)},{0,0})
but how do i set D(x)(0) to "0"?
eq_s_0 = subs(eq_s, {x(0),D(x)(0),y(0)},{0,0,0}) gives me an error: ()-indexing must appear last in an index expression.
  1 件のコメント
Audrius Indriulionis
Audrius Indriulionis 2018 年 7 月 19 日
Hi Birger,
You will find an answer on this link<https://se.mathworks.com/matlabcentral/answers/116008-symbolic-math-substitute-a-derivative-function-with-subs Working Walter example at the end of comments>
rgds Audrius

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

回答 (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