Você está na página 1de 9

%% Vitor de Castro Nobre - 120023717

% Sistema subamortecido

clear all
close all
clc

%Vetor tempo
t0=0;
tf=5;

x0=1;
v0=0;

wn=10;
qsi=0.1;
wd=wn*sqrt(1-qsi^2);
%Numrico
[t, x] = ode45(@mma1, [t0 tf], [v0; x0]);

%Analtico

u=exp(-qsi*wn*t).*(x0*cos(wd*t)+(v0+x0*qsi*wn)/wd.*sin(wd*t));
v=-exp(-qsi*wn*t).*((wd*x0+(v0+x0*qsi^2*wn^2)/wd).*sin(wd*t)+(qsi*wn*x0-
(v0+x0*qsi*wn)*cos(wd*t)));

%Tempo
figure;
plot(t,x(:,2),t,u);
legend('Numrico','Analtico')
xlabel('Tempo, s')
ylabel('Vel,Desl')

%Espao de estados
figure;
plot(x(:,2),x(:,1), u, v)
%,u(:,2),u(:,1))
legend('Numrico','Analtico')
xlabel('Deslocamento, m')
ylabel('Velocidade,m/s')

function xdot = mma(t,x)

wn=10;
qsi=0.1;

A = [-2*qsi*wn, -wn^2; 1, 0];


B = [0; 0];
xdot=A*x+B;
end
1
Numrico
Analtico

0.8

0.6

0.4

0.2
Vel,Desl

-0.2

-0.4

-0.6

-0.8
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Tempo, s
8
Numrico
Analtico

2
Velocidade,m/s

-2

-4

-6

-8

-10
-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Deslocamento, m
%% Vitor de Castro Nobre - 120023717
% Sistema criticamente amortecido

clear all
close all
clc

%Vetor tempo
t0=0;
tf=5;

x0=1;
v0=0;

wn=10;
qsi=1;
wd=wn*sqrt(1-qsi^2);
%Numrico
[t, x] = ode45(@mma2, [t0 tf], [v0; x0]);

%Analtico

u=x0*exp(-wn*t)+(v0+x0*wn)*t.*exp(-wn*t);
v=-((v0+x0*wn)*wn*t+wn*x0-(v0+x0*wn)).*exp(-wn*t);

%Tempo
figure;
plot(t,x(:,2),t,u);
legend('Numrico','Analtico')
xlabel('Tempo, s')
ylabel('Vel,Desl')

%Espao de estados
figure;
plot(x(:,2),x(:,1), u, v)
%,u(:,2),u(:,1))
legend('Numrico','Analtico')
xlabel('Deslocamento, m')
ylabel('Velocidade,m/s')

function xdot = mma(t,x)

wn=10;
qsi=1;

A = [-2*qsi*wn, -wn^2; 1, 0];


B = [0; 0];
xdot=A*x+B;
end
1.2
Numrico
Analtico

0.8

0.6
Vel,Desl

0.4

0.2

-0.2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Tempo, s
0.5
Numrico
Analtico

-0.5

-1
Velocidade,m/s

-1.5

-2

-2.5

-3

-3.5

-4
-0.2 0 0.2 0.4 0.6 0.8 1 1.2
Deslocamento, m
%% Vitor de Castro Nobre - 120023717
% Sistema superamortecido

clear all
close all
clc

%Vetor tempo
t0=0;
tf=5;

x0=1;
v0=0;

wn=10;
qsi=3;
wd=wn*sqrt(1-qsi^2);
%Numrico
[t, x] = ode45(@mma3, [t0 tf], [v0; x0]);

%Analtico

u1=exp(-qsi*wn*t);
u2=(x0*cosh(wn*sqrt(qsi^2-1)*t));
u3=sinh(wn*sqrt(qsi^2-1)*t)*(v0+x0*qsi*wn)/(wn*sqrt(qsi^2-1));
u=u1.*(u2+u3);
v=u1.*((wn*sqrt(qsi^2-1)*x0-(v0+x0*qsi*wn)/(wn*sqrt(qsi^2-
1))*qsi*wn)*sinh(wn*sqrt(qsi^2-1)*t)+(wn*sqrt(qsi^2-
1)*(v0+x0*qsi*wn)/(wn*sqrt(qsi^2-1))-qsi*wn*x0)*cosh(wn*sqrt(qsi^2-1)*t))
%Tempo
figure;
plot(t,x(:,2),t,u);
legend('Numrico','Analtico')
xlabel('Tempo, s')
ylabel('Vel,Desl')

%Espao de estados
figure;
plot(x(:,2),x(:,1), u, v)
%,u(:,2),u(:,1))
legend('Numrico','Analtico')
xlabel('Deslocamento, m')
ylabel('Velocidade,m/s')

function xdot = mma(t,x)

wn=10;
qsi=3;

A = [-2*qsi*wn, -wn^2; 1, 0];


B = [0; 0];
xdot=A*x+B;
end
1
Numrico
Analtico

0.9

0.8

0.7

0.6
Vel,Desl

0.5

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Tempo, s
0
Numrico
Analtico

-0.2

-0.4

-0.6
Velocidade,m/s

-0.8

-1

-1.2

-1.4

-1.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Deslocamento, m

Você também pode gostar