cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

2-Guest

## Modeling ODEs in State Space and using test data as a forcing function

I am using Mathcad Prime 4.0 M010

Looking at Task3-1: "Modeling ODEs in State-Space" in the help file it does not appear that the C or D matrices are used in the state space solution. Can you explain how these matrices would be included? Also, is it possible to use test data (force vs time history from a load cell) for the input forcing function instead of an equation? If so how would this be accomplished. Thanks!

7 REPLIES 7
18-Opal
(To:KenL.)

With the first equation from above, you can simulate and visualize just the state variables (x1,x2,...xn).
The first equation from above includes only matrices: A and B.
The solution for the first equation has nothing to do with matrices C and D.

If you want to simulate and visualize some output variables then you must use the second equation in which you define C and D matrices.
If your system is physically achievable then D = 0, and therefore what you have left is just the C matrix.

Matrice D and C are used only if you want to use the second equation above (which is the output equation, meaning that in this equation you enter only output variables that do you want and need to see at the output of your system).
If you want to simulate just state variables then matrices A and B are necessary and sufficient.

18-Opal
(To:Cornel)

The output equation is a linear combination of state variables, as you can see above.

18-Opal
(To:Cornel)

With the predefined function in Mathcad: state-space you can calculate your state variables, of course using only matrices A and B (because only they are involved in calculating state variables, ie the first equation above), at different times, as the first solution to see different variables/sizes that you want to view, and which are found in the second equation, defined by the matrices C and D, you can proceed as follows:

Where:

But your C matrix can have output variables as many as you want (it does not have to be limited to just one).
I just choose 1 variable output to demonstrate an example of how it can be used.
The matrix D usually in physically achievable systems is 0, that's why we didn't include it, but it can be included.

Don't be scared that it appears red, that it's just a template to get an idea of ​​how it should be implemented.

Here is an example I found of what I have done in the past:

2-Guest
(To:Cornel)

This makes sense thanks a lot.  Is there a way to use force vs time test data as the input u?

18-Opal
(To:KenL.)

What do you think when you say that?
Or what do you mean?

You can use different functions as input.
Below are some examples.

If you have a data set you have to do an interpolation or a regression, and following this process you get a function that goes through the points in your data set or approaches the respective points.
Then you put that function as an input function, as below is shown.

I chose the points so that I don't have to do additional calculations to find the function for interpolation or regression (it's just an example to see, to be simple, but you will have to find the function that fits your set of dates).

2-Guest
(To:Cornel)

I was wondering if there is a way to bring the data points into Mathcad as an array and use that array as an input force without having to fit a function to the data points first.  Sounds like the answer is no, you have to curve fit the data first to come up with a forcing function.  Thanks for taking the time to help me out.

18-Opal
(To:KenL.)

Yes, that's right, you have to first interpolate between your points and find a function that suits your points, and then use that function further in the state space solver.
But most things in engineering are approximations.
There are many ways to find functions that match the points of a data with little error.
therefore I do not see any big problem in this or that this thing should stop you from continuing.
Although I don't know if it's possible to use the points in the dataset in the state space solver before you do any interpolation, anything, whatever the software.

Announcements
Top Tags