0% found this document useful (0 votes)
6 views2 pages

Script Matlab

The document describes the parameters and transfer function of a DC motor, including its inertia, damping, motor constant, resistance, and inductance. It also outlines the design of a PID controller with specified gains and simulates the step response of the closed-loop system. Additionally, it tests the step response with varying integral gains, providing visual results for analysis.

Uploaded by

ihsan25amirul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Script Matlab

The document describes the parameters and transfer function of a DC motor, including its inertia, damping, motor constant, resistance, and inductance. It also outlines the design of a PID controller with specified gains and simulates the step response of the closed-loop system. Additionally, it tests the step response with varying integral gains, providing visual results for analysis.

Uploaded by

ihsan25amirul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

% Parameter Motor DC

J = 0.01; % Momen inersia (Kg.m^2)

b = 0.1; % Damping motor (N.m.s)

K = 0.01; % Konstanta motor (Nm/A)

R = 1; % Resistansi (Ohm)

L = 0.5; % Induktansi (H)

% Transfer Function Motor DC: Theta(s)/Va(s)

num = K;

den = [(J*L) (J*R + b*L) (b*R + K^2)];

motor_tf = tf(num, den);

% Parameter PID

Kp = 100; % Proporsional Gain

Ki = 200; % Integral Gain

Kd = 10; % Derivative Gain

% PID Controller

PID = pid(Kp, Ki, Kd);

% Closed-Loop System

cl_sys = feedback(PID * motor_tf, 1);

% Simulasi Step Response

t = 0:0.01:5; % Waktu simulasi

figure;

step(cl_sys, t);

xlabel('Time (s)');

ylabel('Amplitude');
title('Step Response Of DC Motor with PID Controller');

% Misal uji Kp=100, 150

figure;

Ki_values = [150, 250];

legends = {};

for i = 1:length(Ki_values)

PID_test = pid(Ki_values(i), Kp, Kd);

cl_sys_test = feedback(PID_test * motor_tf, 1);

step(cl_sys_test, t);

hold on;

legends{end+1} = ['Ki = ', num2str(Ki_values(i))];

end

title('Step Response with varying Kp');

xlabel('Time (s)');

ylabel('Amplitude');

legend(legends);

grid on;

You might also like