Dear Andreas,
To tune the parameters in a PID controller, both MATLAB and Simulink could be used.
- OPTION 1: The System Identification Toolbox . With this toolbox, input and output data can be used to identify how the system behaves. Here you could for example load your data in this toolbox and identify the transfer function or the step response of your model.
- OPTION 2: If you no not have this toolbox, you could make an experiment where the step response of your system is calculated. The derivative of this response is equal to the impulse response . Then you could use FFT to perform a fourier transformation of this impulse response. (=transfer function). With the code below you could tune the system yourself:
syms s
% this is an example of a transfer function
num = 1;
den = sym2poly(s^2+2*s+1);
G = tf(num,den);
H = 1; % gain in the feedback loop
step(feedback(G,H));hold on;
%%With a PID controller
K_p = 0.25; % this is a PID controller
K_i = 1; % that doesn't effect the system
K_d = 1;
C=pid(K_p,K_i,K_d);
T=feedback(C*G,H);
step(T);
legend('step response without PID controller','step response with PID controller')
- OPTION 3: If you cannot obtain any step response of your system, you could try to look at the input output relationship and consider what the order of your system is. By many iterations and plots you then find an approximation of the transfer function of your system. With the code in option two, you then can construct a PID controller.
Good luck! Christiaan