No BSD License  

Highlights from
MATLAB for Engineers

from MATLAB for Engineers by Adrian Biran
Companion Software

scissor.m
%SCISSOR.M - simulation of a scissor elevating platform, Example 6.4.
%       Program SCISSOR.M simulates the behavior of the force F
%       in a hydraulic cylinder which actuates a scissors-like
%       elevating platform.

% declare constants
AO = 1.7;       % m
AE = 1.85;      % m
BC = 3.4;       % m
W  = 20000;     % N
d  = 0.5;       % m
V  = 0.05;      % m/s
a  = 0.9;       % initial cylinder length
% _____________
time = [ ];     % initiate array of time values
F  = [ ];       % initiate array of F values
% ______________________ begin loop _____________________
for t = 0: 0.25: 10      % s
     time = [ time t ];  % update array of time values
     EO = a + V*t;       % m
     % calculate angles in radians
     AEO = acos((AE*AE + EO*EO - AO*AO)/(2*AE*EO));
     ABC = acos((AE*AE + AO*AO - EO*EO)/(2*AE*AO));
     % calculate matrix of coefficients
     A = [ cos(ABC) 0 -cos(AEO)
           sin(ABC) 1  sin(AEO)
            0 BC*cos(ABC)/2 0 ];
     % calculate inhomogeneous vector
     B = [ 0; 1; -d ]*W;
     % solve system
     X= A\B;
     F = [ F X(3) ];     % update array of force values
end
plot(time, F)
grid
xlabel('time, t, s')
ylabel('cylinder force, F, N')

Contact us at files@mathworks.com