How do i set the initial values in a subs function?
Show older comments
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 Comment
Audrius Indriulionis
on 19 Jul 2018
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
Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!