Consider the following coupled set of ordinary diferential equations:

\begin{align} (K_{pa}+K_r)y_1(t)-K_ry_2(t)+C_0\operatorname{sign}(\dot{y}_1(t))\lvert\dot{y}_1(t)\rvert^\alpha &= K_{pa}y_0(t)\\ -K_ry_0(t)+2K_ry_1(t)-K_ry_2(t)+C_0\operatorname{sign}(\dot{y}_1(t))\lvert\dot{y}_1(t)\rvert^\alpha &= 0\\ -K_ry_1(t)+2K_ry_2(t)+C_0\operatorname{sign}(\dot{y}_2(t))\lvert\dot{y}_2(t)\rvert^\alpha &= 0 \end{align}

With the state vector: $$\mathbf{y}(t)=\left[ y_1(t) \quad y_2(t) \right]^T$$

And input displacement: $$y_0(t)$$

The initial conditions are equal to 0.

I would like to solve this is Matlab using 'ode45', hence I require to rewrite the ODE's such that the first derivatives appear on the LHS (outside the equal sign). But I can't find a way to do this because of the $\operatorname{sign}(y_k(t))$ involved.

How can I solve this using ODE45 in Matlab?


Thanks for that. So lets assume I have only the following 2 differential equations (to make things easier): $$ (K_{pa}+K_r)y_1(t)-K_ry_2(t)+C_0sign(\dot{y}_1(t))\lvert\dot{y}_1(t)\rvert^\alpha = K_{pa}y_0(t) $$ and $$ -K_ry_1(t)+2K_ry_2(t)+C_0sign(\dot{y}_2(t))\lvert\dot{y}_2(t)\rvert^\alpha = 0 $$

Will the following be correct than? $$ \dot{y}_1=sign\left(\frac{-(K_r+K_{pa})y_1+K_ry_2+K_{pa}y_0}{C_0}\right)\lvert\frac{-(K_r+K_{pa})y_1+K_ry_2+K_{pa}y_0}{C_0}\rvert^{1/\alpha} $$ $$ \dot{y}_2=sign\left(\frac{K_ry_1-2K_ry_2}{C_0}\right)\lvert\frac{K_ry_1-2K_ry_2}{C_0}\rvert^{1/\alpha} $$


You have expressions of the form $sign(u)\,|u|^α=v$. From that one sees that $sign(u)=sign(v)$ and $|u|^α=|v|$ so that finally $$ u=sign(v)\,|v|^{1/α} $$ which allows to write your system as an explicit ODE.

  • $\begingroup$ You can combine the first two equation to obtain a purely "algebraic" equation. Then you are in the realm of DAE, differential-algebraic equations, for the full system. They have their own solution methods, keywords RADAU, DASSL, BDF. $\endgroup$ – LutzL Feb 26 '14 at 14:18
  • $\begingroup$ Unfortunatly I can not solve DAE's using an ODE solver (which is a requirement further in the process). I am stuck to an ODE solver. Do you think that the equations I have added to the bottom of the question (below EDIT) are OK? And able to solve numercially correct using an ODE solver? Thanks! $\endgroup$ – wlamers Feb 26 '14 at 14:25
  • $\begingroup$ Yes, that looks correct. However, now you have to prescribe $y_0$. Another way is to take the derivative of the algebraic equation to obtain the derivative of $y_0$. The solution may deviate from the exact satisfaction of the algebraic equation, but it may still be more useful then just ignoring one equation. $\endgroup$ – LutzL Feb 26 '14 at 14:42

I assume $\alpha>0$. The function $$ p_\alpha(x)=\operatorname{sign}(x)|x|^\alpha\text{ is equal to }\begin{cases} x^\alpha &\text{if $x\ge0$}\\-|x|^\alpha &\text{if $x<0$.}\end{cases} $$ It is strictly increasing. If $\alpha$ is an odd integer then $p_\alpha(x)=x^\alpha$. Its inverse is $$ p_\alpha^{-1}=p_{1/\alpha}. $$ In your equations, from $p_\alpha(\dot y_k)=\text{something}$ you get $\dot y_k=p_{1/\alpha}(\text{something})$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.