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

조회 수: 4 (최근 30일)
Birger Venås
Birger Venås 2016년 12월 15일
댓글: Audrius Indriulionis 2018년 7월 19일
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 CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by