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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

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

KenL.
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
Cornel
17-Peridot
(To:KenL.)

CornelBejan_0-1616444472544.png

 

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.

Cornel
17-Peridot
(To:Cornel)

CornelBejan_0-1616446991763.png

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

Cornel
17-Peridot
(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:

CornelBejan_0-1616494829891.png

CornelBejan_1-1616494846052.png

CornelBejan_2-1616494857065.png

CornelBejan_3-1616494872528.png

 

CornelBejan_4-1616494885837.png

CornelBejan_5-1616494897190.png

 

CornelBejan_6-1616494917740.png

Where: 

CornelBejan_7-1616495273011.png

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.

You just set your example, with your matrices and that's about it.

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

CornelBejan_8-1616495908803.png

CornelBejan_9-1616495918959.png

 

CornelBejan_10-1616495930807.png

 



KenL.
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?

Cornel
17-Peridot
(To:KenL.)

CornelBejan_8-1616528097454.png

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


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

 

CornelBejan_1-1616527408351.png

CornelBejan_2-1616527431390.png

 

CornelBejan_3-1616527549041.png

 

CornelBejan_4-1616527565937.png

 

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.

CornelBejan_5-1616527940170.png

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).

CornelBejan_6-1616528010696.png

 

CornelBejan_7-1616528033394.png

 

 

 

 

KenL.
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. 

Cornel
17-Peridot
(To:KenL.)

CornelBejan_0-1616599208234.png

CornelBejan_1-1616599224738.png

CornelBejan_2-1616599249301.png

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.

 

Top Tags