Vous êtes sur la page 1sur 3

%

% calculates the response of a two-mass, two-spring system


% obtains trajectory using ode45 on DE's in 'de2'
%
%
global m1 m2 k1 k2
% define system parameters
m1= 1.; m2= 1.; k1= 10.; k2 = 10.;
%m1 = 0.29292;
m2 = 0.59376;
2

% system1
k1 = 50.445;
k2 = 34.026

% define system matrix (Minvk)


M = [m1 0; 0 m2];
K = [(k1+k2)
-k2 ; -k2
k2];
MinvK = inv(M)*K;
[V,D] = eig(MinvK);
D
w1 = sqrt(D(1,1))
Tp1=2.*pi/w1
w2 = sqrt(D(2,2))
Tp2=2.*pi/w2
V
tspan1 = [0.:.05:20]; pauseSys = 0.01;
%tspan2 = [0.:.01:10]; pauseSys = 0.01;

% system1
% system2

% calculate trajectory
% 4 INITIAL CONDITIONS: [x1(0) xldot(0) x2(0) x2dot(0)]
[ts,ys] = ode45(@de2,tspan1, [0.618 0 1. 0]);
%[ts,ys] = ode45(@de2,tspan1, [1.618 0 -1. 0]);
%[ts,ys] = ode45(@de2,tspan1, [1 0 .5 0]);

%system
%system
%system

%[ts,ys] = ode45(@de2,tspan2, [0.4119 0 0.9112 0]);


%[ts,ys] = ode45(@de2,tspan2, [0.9760 0 -.2177 0]);
%[ts,ys] = ode45(@de2,tspan2, [1 0 1. 0]);

%system
%system
%system

plot(ts, ys(:,1), ts, ys(:,3), 'LineWidth', 2);


reply = input('PRESS ENTER TO PROCEED');
% SIMULATION

% system