Sie sind auf Seite 1von 1

function [J] = pid_optim(X)

% reference speed m/s


%Please adjust it according to the solutions of your task 1
r = 10;

%% Don't change the codes in this section below


m = 1000; % vehicle mass 1000 kg
b = 50; % damping coefficient 50 N.s/m
s = tf('s');
P_cruise = 1/(m*s+b); % vehicle model

Kp = X(1); % proportional gain


Ki = X(2); % integral gain
Kd = X(3); % derivative gain

C = pid(Kp,Ki,Kd); % PID controller


T = feedback(C*P_cruise,1); % closed-loop vehicle systems

dt=0.1;
t = 0:dt:50;
y = step(r*T,t);
%% Don't change the codes in the section above

J = ; % define the objective function of the control systems


figure(2)
step(r*T,t);

Das könnte Ihnen auch gefallen