Anda di halaman 1dari 18

# for i = 1: 101

t(i) = 5 * (i-1)/100;
x(i) = 0.0146 * sin(9.35 * t(i) + 0.7518);
x1(i) = 0.13651* cos(9.35 * t(i) + 0.7518);
x2(i) = -1.276 * sin(9.35 * t(i) + 0.7518);
f1(i)=40*x2(i);
f2(i)=3500*x(i);
end
subplot (311);
plot (t,x);
ylabel('x(t)');
xlabel('t(sec)');
grid;
title('Example 1');
subplot(312);
plot(t,f1);
ylabel('Inertia Force(kN)');
xlabel('t(sec)');
grid;
subplot(313);
plot(t,f2);
ylabel('Elastic Force(kN)');
xlabel('t(sec)');
grid;

for i = 1: 101
t(i) = 5 * (i-1)/100;
x(i) = 0.0146 * sin(9.35 * t(i) + 0.7518);
x1(i) = 0.13651* cos(9.35 * t(i) + 0.7518);
x2(i) = -1.276 * sin(9.35 * t(i) + 0.7518);
end
subplot (311);
plot (t,x);
ylabel('x(t)');
xlabel('t (sec)');
grid;
title('Example 2(a)');
subplot(312);
plot(t,x1);
ylabel('Velocity, x^. (m/s)');
xlabel('t (sec)');
grid;
subplot(313);
plot(t,x2);
ylabel('Accn, x^.^. (m/s^2)');
xlabel('t (sec)');
grid;

for i = 1: 101
t(i) = 5 * (i-1)/100;
x(i) = 0.01069 * sin(9.35 * t(i));
x1(i) = 0.0999* cos(9.35 * t(i));
x2(i) = -0.9345 * sin(9.35 * t(i));
end
subplot (311);
plot (t,x);
ylabel('x(t)');
xlabel('t (sec)');
grid;
title('Example 2(b)');
subplot(312);
plot(t,x1);
ylabel('Velocity, x^. (m/s)');
xlabel('t (sec)');
grid;
subplot(313);
plot(t,x2);
ylabel('Accn, x^.^. (m/s^2)');
xlabel('t (sec)');
grid;

for i = 1: 101
t(i) = 5 * (i-1)/100;
x(i) = 0.01 * sin(9.35 * t(i)+1.570);
x1(i) = 0.0935* cos(9.35 * t(i)+1.570);
x2(i) = -0.874225 * sin(9.35 * t(i)+1.570);
end
subplot (311);
plot (t,x);
ylabel('x(t)');
xlabel('t (sec)');
grid;
title('Example 2(c)');
subplot(312);
plot(t,x1);
ylabel('Velocity, x^. (m/s)');
xlabel('t (sec)');
grid;
subplot(313);
plot(t,x2);
ylabel('Accn, x^.^. (m/s^2)');
xlabel('t (sec)');
grid;

for i = 1: 101
t(i) = 10 * (i-1)/100;
x(i) = 0.023427 *2.71^(-0.2235*t(i))* sin(4.46* t(i)+1.023);
x1(i) = 0.023427 *2.71^(-0.2235*t(i))* (-0.2235*sin(4.46* t(i)+1.023)+4.464*cos(4.46*
t(i)+1.023));
end
subplot (311);
plot (t,x);
ylabel('x(t)');
xlabel('t (sec)');
grid;
title('Example 3');
subplot(312);
plot(t,x1);
ylabel('Velocity, x^. (m/s)');
xlabel('t (sec)');
grid;

for i = 1: 101
t(i) = 10 * (i-1)/100;
x1(i) = 0.01437* sin(9.68* t(i)+0.769);
x2(i) = 0.01471 *2.71^(-0.484*t(i))* sin(9.66* t(i)+0.7449);
x3(i) = 0.0151 *2.71^(-0.968*t(i))* sin(9.6314* t(i)+0.7206);
end
subplot (311);
plot (t,x1);
ylabel('x(t)');
xlabel('t (sec)');
grid;
title('0% Damping');
subplot(312);
plot(t,x2);
ylabel('x(t)');
xlabel('t (sec)');
title('5% Damping');
grid;
subplot(313);
plot(t,x3);
ylabel('x(t)');
xlabel('t (sec)');
title('10% Damping');
grid;

for i = 1: 101
t(i) = 10 * (i-1)/100;
x(i) = 0.01485 *2.71^(-0.6248*t(i))* sin(9.66* t(i)+0.7378);
x1(i) = 0.01485 *2.71^(-0.6248*t(i))* (-0.6248*sin(9.66* t(i)+0.7378)+9.66*cos(9.66*
t(i)+0.7378));
f1(i)= 3750*x(i);
f2(i)=50*x1(i);
f3(i)= -f1(i)- f2(i);
end
subplot(311);
plot(t,f3);
ylabel('Inertia Force(kN)');
xlabel('t (sec)');
grid;
title('Example 5');
subplot(312);
plot (t,f2);
ylabel('Damping Force(kN)');
xlabel('t (sec)');
grid;
subplot (313);
plot (t,f1);
ylabel('Elastic Force(kN)');
xlabel('t (sec)');
grid;

6. [x,v]=meshgrid(-0.1:0.01:0.1 ,-1:0.1:1);
a= sqrt(400*x.*x + v.*v)/20;
surf(x,v,a)
xlabel('x_0 (m)');
ylabel('v_0 (m/s)');
zlabel('Amplitude (m)');

## MATLAB Code for Example 4

for i = 1: 101
t(i) = 10 * (i-1)/100;
x(i) = 0.0224 *2.71^(-0.6248*t(i))* sin(9.66* t(i)+0.7378);
x1(i) = 0.0224 *2.71^(-0.6248*t(i))* (-0.6248*sin(9.66* t(i)+0.7378)+9.66*cos(9.66* t(i)
+0.7378));
f1(i)= 4000*x(i);
f2(i)=50*x1(i);
f3(i)= -f1(i)- f2(i);
end
subplot(311);
plot(t,f3);
ylabel('Inertia Force(kN)');
xlabel('t (sec)');
grid;
title('Example 4');
subplot(312);
plot (t,f2);
ylabel('Damping Force(kN)');
xlabel('t (sec)');
grid;
subplot (313);
plot (t,f1);
ylabel('Elastic Force(kN)');
xlabel('t (sec)'); grid;

## MATLAB Code for Example 6

a0=.25;
mug=1.47;
t=0:0.01:3;
omega=14.14;
phi=omega;
beta=0.007359;
a=a0-((2*mug*t)/(pi*omega));
u=a.*cos(omega*t+phi)+beta;
subplot(311);
plot(t,u,t,a,'--',t,-a,'--');
ylabel('x(t)');
xlabel('t (sec)');
grid;