Initial condition in state-space block in Simulink
22 views (last 30 days)
Show older comments
Hi!
I have a very basic problem with Simulink's state-space block. I'm simulating a very basic first order dynamics with time constant T=0.35s. I made a transfer function for the system and also converted it to a state-space representation because this form is the only one where I can give an initial condition for the system. However, it seems that the initial condition does not work correctly. The simulated system is shown below:

I have the transfer function model and the state-space block parallel in Simulink and I feed a constant input signal to both of them (constant block value = 10). First when I simulate the blocks such that the initial condition for the system is 0 (automatically for tf-representation and ss-block). The outputs of the both systems are identical as expected. See the correct results below:

Next I simulate again with the same input signal (constant = 10). However I change the initial condition to -20 for the state-space system. The results are shown below:

As we can see, both system's approach the reference value (10) but the state-space system starts from somewhere else than from -20. This bothers me. As seen in the first simulation, the initial condition 0 (default) works fine. The system starts from zero really. But with -20 the system starts from somewhere near to -55. What is happening? What I do wrong when setting the initial condition?
0 Comments
Answers (2)
Sebastian Castro
on 16 Sep 2015
Remember that the initial conditions affect the states x and not the outputs y.
My guess is that your C matrix has some scaling factor such that the initial output is -55 and not -20?
Also, there are Transfer Function blocks that allow you specify initial conditions. You can find these under Simulink Extras > Additional Linear.
- Sebastian
0 Comments
Sergio Tamayo
on 24 Feb 2017
Hey Joonas Sainio!
You must identify clearly your state variables, I mean which is x1, x2,..., xn, because the initial conditions works as a vector that affect each state variable that you want. E.g. I have 2 state variables of an inverted pendulum (\theta, \dot{theta}), I want to start the system in pi/36 rad (i.e. 5°). To reach this I write in initial conditions: [pi/36 0], where pi/36 affect my \theta and \dot{theta} (my angular velocity) is kept 0.
2 Comments
MADDEPPA PUJARI
on 11 Oct 2021
@Sebastian Castro, sir i want simulate a model for 4 input and 4 output the system, i does i can give inputs values such as u1, u2,u3,u4 to the state space model in matlab simulink
See Also
Categories
Find more on Trimming and Linearization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!