Simulating a plant in Simulink
29 views (last 30 days)
Show older comments
I decided to learn simulink and matlab since I'm interested in control engineering, been trying to solve some simple problems and this one in particular has been quite troublesome. Can anyone point me in the right direction? What am I doing wrong?
This is what I've been trying to simulate:

This is what I've done in simulink:

Quite unsure about the results of the simulation.
I solved that so I have values for T but still simulating it isn't as simple as it seemed. For stability 0 < T < 0.2 if T > 0.2 it's unstable
2 Comments
Answers (1)
Paul
on 14 Nov 2023
The Zero-Order Hold block with Sample Time parameter set to an expression that evaluates to the sampling period T does the sample and hold operation in the first block diagram. Looks like the Simulink model is ok.
We can compare the Simulink model to Control System Toolbox, for T = 0.2.
P = tf(10,[1 1]);
T = 0.2;
H = feedback(c2d(P,T,'zoh'),1);
t = 0:T:8;
y = lsim(H,t>=1);
figure
plot(t,y,'-o')
The difference betwee the CST and Simulink is that Simulink is using its ode solver to compute the output of the plant, potentially between the sampling times depenending on the solver settings, whereas this CST code is approximating the plant with a discrete-time approximation and only computes the output at the sample times. But the Simullink and CST results are very close at the sample times for the given sampling period.
0 Comments
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!