# Add terms to previously defined differential equation (Symbolic)

1 ビュー (過去 30 日間)
Marco Asperti 2020 年 10 月 10 日
コメント済み: Marco Asperti 2020 年 10 月 10 日
I everyone!
I have a question related to the usage of the Symbolic Toolbox to solve differential equations.
Suppose I have already defined the differential equation associated with a mass-spring system:
syms x(t) m k
eq_undamped = m*diff(x,2) + k*x == 0 ;
Now, suppose I want to add the damping term to the left hand of the equation defined above:
syms b
v = diff(x) ;
damping = b*v ;
How can I add damping to the left hand side of eq_undamped, obtaining something like:
eq_damped = m*diff(x,2) + k*x + b*diff(x) == 0 ;
I would like not to enter the equation above manually, but combining the previously defined eq_undamped and damping.

#### 1 件のコメント

VBBV 2020 年 10 月 10 日
eq_damped = m*diff(x,2) + k*x + damping == 0 ;

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

### 採用された回答

madhan ravi 2020 年 10 月 10 日
eq_damped = lhs(eq_undamped) + damping == rhs(eq_undamped)

#### 1 件のコメント

Marco Asperti 2020 年 10 月 10 日
Great! Thank you very much for your help 😊

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

### Community Treasure Hunt

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

Start Hunting!