Challenge

Project - Position control of mass spring damper system

% nominal parametr of the spring mass system
m = 3.6; % mass of the spring mass system
k = 400.0; % stiffness constant of the spring mass system
%design parameters
fn = 1.0; % wn/(2*pi) H/z
wn = 6.2832; % sqrt(k/m) radian
zeta = 0.5;
% desired poles
p1 = -zeta*wn+wn*sqrt(zeta^2-1);
p2 = -zeta*wn-wn*sqrt(zeta^2-1);
P = [p1,p2];
% A and B matrices
A = [0 1;-k/m 0];
B = [0;1/m];
% pole placement design
K = place(A,B,P);
% kp and kd gains are obtained by the PLACE command
kp = -257.8770;
kd = 22.6195;
ki = 2500;
% Dynamics
% x1_dot = x2
% x2_dot = (-k/m)*x1+(1/m)*u
% x2_dot = (-k/m)*x1+(1/m)*[kp*(x1ref-x1)-kd*x2+ ki*int(x1ref-x1)*dt]
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.