Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.6K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to recover variables from NonlinearStateSpaceModel

Dear member

I have been exploring the function NonlinearStateSpaceModel. The documentation offers several examples of use. Like in some other systems such as StateSpaceModel, NonlinearStateSpaceModel returns a nice and very descriptive table.

First question, what kind of Mathematica object is the result of NonlinearStateSpaceModel? It is clear that is neither a matrix nor a table.

There are also useful functions that can operate over state space models such as SystemsModelOrder. My question is if there is a way to recover the different parts of the model for instance: the state variables and the inputs?.

Regards

Jesus Rico

2 Replies

Patrik, It totally helped, Your answer should be part of the wolfram documentation. Thanks a lot!

Jesús

Hi Jesus Rico!

First question, what kind of Mathematica object is the result of NonlinearStateSpaceModel?

It is an expression of the type "NonlinearStateSpaceModel" so it is a unique type of object. I'll use the first model from the documentation:

In[1]:= nsys = NonlinearStateSpaceModel[{{u - Subscript[x, 1] Subscript[x, 2], u Subscript[x, 2] + 1}, 
{Subscript[x, 1]}}, {Subscript[x,1],  Subscript[x, 2]}, u];
In[2]:= Head[nsys]
Out[2]:= NonlinearStateSpaceModel

You can extract parts of the expression by taking different parts using the double bracket notation or Part[] function:

In[3]:= nsys[[1]]
Out[3]:= {{u - Subscript[x, 1] Subscript[x, 2], 1 + u Subscript[x, 2]}, {Subscript[x, 1]}}

is if there is a way to recover the different parts of the model for instance: the state variables and the inputs?.

The model is normally specified like this:

NonlinearStateSpaceModel[{f,g},x,u]

Hence, the first part will be a list of the the (set of) functions f and g where x'(t)==f(x(t) and y(t)==g(x(t)). To find the equation for the first state variable x1, you would write:

nsys[[1,1,1]]

Part 2 is a list of the states and part 3 is a list of the input variables!

Hope that helps!

Patrik

POSTED BY: Patrik Ekenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard