What do I do wrong when using the stepplot command?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nico van der Aa
el 8 de En. de 2022
Editada: Nico van der Aa
el 13 de En. de 2022
I have defined a first order system
and a PI controller
as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857075/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857080/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857085/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857090/image.png)
In matlab code
tau = 0.1;
G_plant = tf(1,[tau 1]);
alpha = -0.1;
Gc = tf([1 alpha],[1 0]);
The controller should also have a gain value and I'm varying it from 0 to 10. My expectation is that, because of the PI-controller, the step response goes to 1 eventually for all gain values I choose. It does so, for gain values up to 8, but for a gain value of 9, I observe something strange. Could you help me explaining this phenomenon?
My code to draw the step responses for the PI-controlled system is
G_openloop = Gc*G_plant;
T = feedback(9*G_openloop,1)
stepplot(T);
Even if I compute the DC gain, it goes to 1, but the stepplot doesn't.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857095/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857100/image.png)
For the green line (K = 9) a strange bending of the curve occurs around time 2 seconds and the green line never goes to its steady state of 1.
0 comentarios
Respuesta aceptada
Pratyush Roy
el 11 de En. de 2022
Hi Nico,
Although it might seem like the step response for gain values do not approach the steady state value of 1, this might be because it reaches steady state at a later stage due to the value of K chosen. To observe that, we can change the tFinal input argument for the stepplot command final time for step response computation to be a very high value, say 100.
Here is a script that illustrates how to change the tFinal value:
tau = 0.1;
G_plant = tf(1,[tau 1]);
alpha = 0.2;
Gc = tf([1 alpha],[1 0]);
K = 5:0.4:9;
for i=1:length(K)
G_openloop = Gc*G_plant;
T = feedback(K(i)*G_openloop,1);
hold on
stepplot(T,100);
end
hold off
Hope this helps!
1 comentario
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!