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