I need to add a disturbance factor 0.2 value after 500 sec ,when my system is stable in order to check the stability while using PID controller in MATLAB code . what to do ??
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a closed loop transfer funtion with PID controller but i need to add a distrunabe value 0.2 after 500 sec in the output response to check disturbance rejection form the system. for that in MATLAB code what to do
0 Kommentare
Antworten (1)
Joel
am 14 Mär. 2023
Hi,
I understand that you want to write MATLAB code to be able to add a disturbance at some given time while simulating your system and observe system dynamics. This can easily be done on Simulink using the step and transfer function blocks.
To achieve this in MATLAB, you should use the ‘lsim’ function. An example code is as follows:
TF = tf([1 3],[1 5 3]); % some transfer function
h = 0.001; % sample time
T = 1000; % simulation time
t = 0:h:T; % time samples
T_dist = 500; % time at which disturbance is introduced
t1 = 0:h:T_dist-h;
t2 = T_dist:h:T;
% divide the input signal into two parts. initial input of 1 is given at 0s and
% disturbance of 0.2 is given at 500s.
u = [ones(1,length(t1)),0.2*ones(1,length(t2))];
lsim(TF,u,t);
Please refer to the following documentation for more information: Plot simulated time response of dynamic system to arbitrary inputs; simulated response data - MATLAB lsim - MathWorks India
0 Kommentare
Siehe auch
Kategorien
Mehr zu PID Controller Tuning finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!