1
$\begingroup$

I would like to perform a change of variables on the following dynamics system:

system = NonlinearStateSpaceModel[{{y1'[t] == y2[t], 
y2'[t] == -theta[t]^2 y1[t] + 
  theta'[t] y2[t]/theta[t]}, {alpha1 y1[t] + alpha2 y2[t]}}, {y1[
t], y2[t]}, {}]

The change of variables would be: y2[t] -> theta[t] y3[t]. While I could easily see what would be the outcome by hand, I don't see why this command would not return anything with Mathematica:

StateSpaceTransform[system, {{y2[t] -> theta[t] y3[t]}, {y3[t] -> 
y2[t]/theta[t]}}]

The error I receive is meaningless in my honest point of view since:

Length@ {{y2[t] -> theta[t] y3[t]}, {y3[t] -> 
y2[t]/theta[t]}}

returns 2.

$\endgroup$
  • $\begingroup$ It's Length /@ that must give {2, 2}. It wants 2 transformations going both ways. Since you have to put something in for a second transformation in each, how about putting y1[t] -> y1[t] into both of them? $\endgroup$ – LouisB Jul 23 '19 at 9:16
  • $\begingroup$ Yes you're right. I added the two dummy transformations but it seams to say that the system is not a valid nonlinear state space model... I guess Mathematica doesn't like the time varying parameters $\endgroup$ – Mirko Aveta Jul 23 '19 at 9:45
  • 1
    $\begingroup$ If MMA doesn't like time varying parameters, make them state variables. Maybe it's the $\frac{d\theta}{dt}$ that's confusing things. What governs the time evolution of $\theta$ anyway? $\endgroup$ – LouisB Jul 23 '19 at 10:24
  • $\begingroup$ It is unknown. I was just willing to see the pretty change of variables. It's a petty that TV systems are not treated by Mathematica. Most industrial applications are modeled as such. $\endgroup$ – Mirko Aveta Jul 23 '19 at 11:18
1
$\begingroup$

(Several points that make it too long for a comment.)

  • As @LouisB points out in the comments, StateSpaceTrasform is expecting a transformation of dimension {2, 2}.

  • The usage of NonlinearStateSpaceModel should be something as shown below. What you have is GIGO. (Just try StateSpaceModel[system].)

    eqns = {D[y1[t], t] == y2[t], 
        D[y2[t], t] == -theta[t]^2 y1[t] + D[theta[t], t] y2[t]/theta[t]};
    
    NonlinearStateSpaceModel[eqns, {y1[t], y2[t], theta[t]}, {}, 
    {alpha1 y1[t] + alpha2 y2[t]}, t]
    
  • Next, what you want as your state space is not clear. What is the initial state-space? $\{y1, y2\}$ or $\{y1, y2, theta\}$. When you invoke StateSpaceTransform what do you want your final state-space to be?

  • And finally, the system you have is problematic. This is related to the point above. You need to have a well-defined state space for any computations to make sense.

    NDSolve[Join[eqns, {y1[0]==1,y2[0]==0,theta[0]==0.01}],{y1,y2},{t,0,1}]
    

    returns unevaluated with the message

    NDSolve::underdet: There are more dependent variables, {theta[t],y1[t],y2[t]}, than equations, so the system is underdetermined.

Update

Convert to state-space form. To do this we need to briefly consider the time-varying parameter as constant.

system = With[{tempRules = {theta[t] -> theta, theta'[t] -> thetaD}},
   NonlinearStateSpaceModel[eqns /. tempRules, 
   {y1[t], y2[t]}, {}, {alpha1 y1[t] + alpha2 y2[t]}, t] /. Reverse /@ tempRules]

enter image description here

Then perform the state-space transformation.

StateSpaceTransform[system, {{1, 0}, {0, theta[t]}}]

enter image description here

|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ Hi Suba! My initial state-space is {y1,y2} as I mentioned above, so I expect the new state space to be {y1,y3}. In my point of view theta[t] is not a state, it is a time-varying quantity making the system non-autonomous. I do not want to define it with a specific function. $\endgroup$ – Mirko Aveta Jul 24 '19 at 7:40
  • $\begingroup$ Hi Mirko. Currently, when converting from a differential or difference equation the time dependent parameters need to be either a state or an input variable. You can circumvent this by temporarily assigning them to constants when the conversion to state-space form happens. Pls see my update. $\endgroup$ – Suba Thomas Jul 24 '19 at 13:38
  • $\begingroup$ The problem with this convention is that you miss the derivatives when converting: I I do the derivative of y2 I would have to see theta' y3+theta y3'. This seams to be missing with the assignment you're suggesting. I would expect from the change of variables a real Jordan form. $\endgroup$ – Mirko Aveta Jul 25 '19 at 11:27
  • 1
    $\begingroup$ I see. Yes. It is a bug that needs to be fixed. $\endgroup$ – Suba Thomas Jul 25 '19 at 13:56
  • 1
    $\begingroup$ The fix will be in the next release. Thanks. $\endgroup$ – Suba Thomas Aug 1 '19 at 16:52

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.