matlab question response question
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
johnaly7
am 13 Mär. 2014
Bearbeitet: johnaly7
am 21 Jul. 2014
I have a control system with a PID controller, and im trying to simulate a system response, i need to plot the values first in a graph and then add the transfer function?
this is what i have found and im doing:
dt = 0.1; t = 0:dt:50; u = zeros(1,numel(t)); u(t<=20) = 45; u(t> 20 & t<=40) = -45; u(t> 40) = 0;
obviously with the lsim command
Is there a better way ?
Thanks in advance
0 Kommentare
Akzeptierte Antwort
Mischa Kim
am 14 Mär. 2014
Bearbeitet: Mischa Kim
am 14 Mär. 2014
John, you just need to build the signal (no need for plotting), e.g.,
dt = 0.1; % adjust as necessary
t = 0:dt:50;
u = zeros(1,numel(t));
u(t<=20) = 45; % you probably want to use rad instead of deg
u(t> 20 & t<=40) = -45;
u(t> 40) = 0;
and feed it as an input to the system.
1 Kommentar
Mischa Kim
am 14 Mär. 2014
Bearbeitet: Mischa Kim
am 14 Mär. 2014
Correct,
lsim(sys,u,t)
or similar. You might have/want to specify initial conditions x0 for the system, in which case you'll have an additional parameter.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu PID Controller Tuning finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!