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$
4
  • $\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
    Commented Jul 23, 2019 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$ Commented Jul 23, 2019 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
    Commented Jul 23, 2019 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$ Commented Jul 23, 2019 at 11:18

1 Answer 1

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

$\endgroup$
5
  • 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$ Commented Jul 24, 2019 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$ Commented Jul 24, 2019 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$ Commented Jul 25, 2019 at 11:27
  • 1
    $\begingroup$ I see. Yes. It is a bug that needs to be fixed. $\endgroup$ Commented Jul 25, 2019 at 13:56
  • 1
    $\begingroup$ The fix will be in the next release. Thanks. $\endgroup$ Commented Aug 1, 2019 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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