Closed Form Solution
The following is the Matlab code for closed form solution
for a brake pedal problem.
x is theta and xdot is theta_dot.
clear all;
%
% necessary input constant
%
N = 5000;
m = 5;
k0 = 1000;
c0 = 0.7;
k = 500;
l = 0.3;
a = 0.1;
I = m/12*(2*a)^2;
wn = sqrt((k0+k*a^2)/I)
zeta = c0/(2*wn*I)
wd = wn*sqrt(1-zeta^2);
% wd is the damped natural frequency
t_final = 0.5; % calculation time
n = 5000; % number of data points
At the beginning of the program, we need to write some constant inputs.
n is the number of the data points.
x_0 = Need to fill this in; % initial displacement for homogenous
% solution
xdot_0 = Need to fill this in;
% initial velocity for homogeenous
% solution
Then, initial conditions are followed.
X_0 = sqrt(x_0^2+((xdot_0+zeta*wn*x_0)/wd)^2);
phi = acos(x_0/X_0);
% X_0 is the amplitude of response and
% phi is the phase angle of the response
% Remember that this is about complimentary (homogeneous) solution
% therefore, only thing you have to include is initial conditions
Calculate the amplitude and the phase angle with given
initial conditions.
t = 0:t_final/n:t_final;
x = X_0*exp(-zeta*wn*t).*cos(wd*t+phi); % displacement x(t)
xdot = X_0*exp(-zeta*wn*t).*(-zeta*wn*cos(wd*t+phi)-wd*sin(wd*t+phi));
% velocity xdot(t)
And we can determine the displacement x(t) and velocity
xdot(t).
Click here for the entire
Matlab source code for closed form solution.