0% found this document useful (0 votes)
14 views

Robotics Assignment - 1 Matlab Program On Symbolic Functions in Which Differential Equation, Constraints and Optimization Are Included

This document contains a MATLAB program that models a spring-mass-damper system using a differential equation. The program applies proportional (P), integral (I), and derivative (D) control and compares their effects on the system. It defines the system model, applies different PID controller configurations, and plots the step response for each configuration on a graph. The program was submitted as a robotics assignment by four students (listed by their student IDs).

Uploaded by

ramphal chowk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Robotics Assignment - 1 Matlab Program On Symbolic Functions in Which Differential Equation, Constraints and Optimization Are Included

This document contains a MATLAB program that models a spring-mass-damper system using a differential equation. The program applies proportional (P), integral (I), and derivative (D) control and compares their effects on the system. It defines the system model, applies different PID controller configurations, and plots the step response for each configuration on a graph. The program was submitted as a robotics assignment by four students (listed by their student IDs).

Uploaded by

ramphal chowk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SUBMITTED BY:-

2017UMP3575-KESHAV PAL

2017UMP3573-SURAJ BHAGAT

2017UMP3592-VIPESH

2017UMP3597-SHRAWAN BHATIA

ROBOTICS ASSIGNMENT -1
MATLAB PROGRAM ON SYMBOLIC FUNCTIONS IN WHICH
DIFFERENTIAL EQUATION, CONSTRAINTS AND OPTIMIZATION ARE
INCLUDED

MATLAB CODE

% Application of P, PI, and PID to spring-mass-damper model.


% Model Equation: mx’’ + cx’ + kx = F
% Transfer Function (Laplace Transform of model): X(s)/F(s) = 1/(ms^2 + cs + k)
% m = mass of block, c = damping constant, k = spring constant
% F is the applied force
% x is the resulting displacement of the block
m = 1; % 1 kg
c = 20; % 12 N-s/m
k = 25; % 20 N/m
% Open-Loop Response
s = tf(‘s’);
P = 1/(m*s^2 + c*s + k) % Transfer function
step(P)
% PID Control Values
Kp = 200;
Kd = 10;
Ki = 70;
% Time-step 0.01 s
t = 0:0.01:5;
hold on
% Only Proportional Control
C1 = pid(Kp,0,0)
T1 = feedback(C1*P,1) % Transfer function with P-only controller
step(T1,t)
% Only Integral Control
C2 = pid(0,Ki,0)
T2 = feedback(C2*P,1) % Transfer function with P-only controller
step(T2,t)
% Only Derivative Control
C3 = pid(0,0,Kd)
T3 = feedback(C3*P,1) % Transfer function with P-only controller
step(T3,t)
% Proportional-Derivative Control
C4 = pid(Kp,0,Kd)
T4 = feedback(C4*P,1)
step(T4,t)
% Proportional-Integral Control
C5 = pid(Kp,Ki,0)
T5 = feedback(C5*P,1)
step(T5,t)
% Proportional-Integral-Derivative Control
C6 = pid(Kp,Ki,Kd)
T6 = feedback(C6*P,1)
step(T6,t)
legend(‘P only Control’,’I only Control’,’D only Control’,’PD Control’,’PI
Control’,’PID Control’)

OUTPUT
OUTPUT
GRAPH

SUBMITTED BY:-

2017UMP3575-KESHAV PAL
2017UMP3573-SURAJ BHAGAT
2017UMP3592-VIPESH
2017UMP3597-SHRAWAN BHATIA

You might also like