Simulating a plant in Simulink

32 visualizaciones (últimos 30 días)
Caio
Caio el 13 de Nov. de 2023
Respondida: Paul el 14 de Nov. de 2023
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 comentarios
Paul
Paul el 14 de Nov. de 2023
Hi Caio,
Why are you unsure about the results of the simulation?
Caio
Caio el 14 de Nov. de 2023
Editada: Caio el 14 de Nov. de 2023
Cause I'm unsure if what I simulated is actually what was in the block diagram. I tried following it but couldn't find some of the blocks in simulink, i.e the T, also was quite unsure how to do the ZOH block so I assumed that the one I used would be it. Maybe I'm making it complicated idk. Just trying simulink out, I read the docs but couldn't find anything to shine a light on this one.

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 14 de Nov. de 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.

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by