Continuous transformation of state space models

5 views (last 30 days)
Morvan
Morvan on 2 Jul 2020
Commented: Morvan on 6 Jul 2020
Hello !
I have two 1st-order transfer functions. The second one (TF2 with gain G2) has a gain divided by 4 compared to the first one (TF1 with gain G1), the denominators are the same (later, I will also want to change the response time, but not now for simplicity). And I want to simulate a continuous change from TF1 to TF2 during 100 seconds.
For the simulation, at each step (sampling time is 1s), I create a transfer function with a gain G depending on G1 and G2. For example: from t=0s to t=399s G=G1, from t=400s to t=599s G=(1-(t-400)/200)*G1+((t-400)/200)*G2, t=600s to t=1000s G=G2. Then I transform it into a state space using the ''ss'' Matlab function, and uses its matrices A, B, C and D to calculate the states x and output y at each step, depending on the input u.
My problem is, although the gain of the transfer function (and the transfer function) is changing ''smoothly'', there is a specific time step when the state space representation changes ''not smoothly''. Matrices B and C have coefficients that change a lot in one step (it is not the case for all the other time steps). This gives me a discontinuity in the calculation of my output, that is not matching the physical reality of the system I simulate. The state space representation is good in its whole, but the sudden big change in the parameters of its matrices messes with my simulation.
You can see it on the image below at time t=420s.
Do you know how to solve that? I am personally looking for a systematic way to transform my transfer function into a state space. The ''ss'' function alone leads to my current problem. (Ideally, a function/property/... that already exists and that I would not have to code this myself ^^)
Maybe there is another way to define the systems and simulate them ? I would actually like to keep working with matrices A, B, C and D from the state space representation for the simulations (for some reasons), but I am open to any idea.
Thanks a lot for your feedbacks ! :)
Don't hesitate to ask for more details if needed. It is clear in my head but might not be as clear in the words above...
Morvan
  1 Comment
Morvan
Morvan on 6 Jul 2020
Hello again ! :)
I have found a solution, that I am half satisfies about...
I define myself the matrices A, B, C and D using the controllable canonical form. That way, the matrices are derived in a systematic way and their coefficients change more smoothly.
Not totally happy about it for 2 reasons. I define those matrices from a simple transfer function, so if I want to use a more complex system (add a delay, more inputs or outputs, ...) it won't work anymore the way I coded it. And (I belive that !...) when I simulate this, I don't have discontinuities anymore on the output variable, but the derivative seems discontinuous.
So still waiting for a smarter solution if you have ! :)
I was expecting an answer from someone who already had the same issue. But I can share my code with you if you want to have a deeper look into my problem.
Morvan

Sign in to comment.

Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!