You are on page 1of 6

m =10;

k = 1000;
x0 = 0.05;
v0 = 0.5;
Cc = 2*sqrt(k*m);
wn = sqrt(k/m);
c1 = 50;
z1 = c1/Cc;
wd = sqrt(1-z1^2)*wn;
y = z1*wn;
y1 = (v0+z1*wn*x0)/wd;
c2 = 200;
z2 = c2/Cc;
y3 = wn*x0;
c3 = 300;
z3 = c3/Cc;
y4 = (1/(2*(sqrt(z3^2-1))*wn));
y5 = (v0+(z3+sqrt(z3^2-1))*wn*x0);
y6 = (-z3+sqrt(z3^2-1))*wn;
y7 = (v0+(z3-sqrt(z3^2-1))*wn*x0);
y8 = (-z3-sqrt(z3^2-1))*wn;

fprintf(' When the value of damping costant is 50 N.s/m.\n


Since the zeta value %f is less than 1 , so the system is
under-damped.\n',z1)
fprintf('The response of the system is given by\n x(t) = e^-
%ft[%fsin(%f) +%fcos(%ft)]\n\n',y,y1,wd,x0,wd)
fprintf(' When the value of damping costant is 200 N.s/m.\n
Since the zeta value is equal 1 , so the system is
critically damped.\n')
fprintf('The response of the system is given by\n x(t) = e^-
%ft[%f + %ft]\n\n',wn,x0,y3)
fprintf(' When the value of damping costant is 300 N.s/m.\n
Since the zeta value is greater than 1 , so the system is
overdamped damped.\n')
fprintf('The response of the system is given by\n x(t) =
%f*[%f*e^%ft - %f*e^%ft]',y4,y5,y6,y7,y8)
t = 0:0.01:3;
x1 = (exp(-y.*t)).*y1.*(sin(wd.*t)+x0.*cos(wd.*t));
x2 = (x0+y3.*t).*exp(-wn.*t);
x3 = y4.*(y5.*exp(y6.*t)-y7.*exp(y8.*t))
hold on ;
plot(t,x1,'linewidth',1.1)
plot(t,x2,'linewidth',1.1)
plot(t,x3,'linewidth',1.1)
grid on ;
xlabel('t');
ylabel('x(t)');
legend('under damped','critically damped','over damped')

# output of the programme

When the value of damping costant is 50 N.s/m.


Since the zeta value 0.250000 is less than 1 , so the system is
under-damped.
The response of the system is given by
x(t) = e^-2.500000t[0.064550sin(9.682458)
+0.050000cos(9.682458t)]

When the value of damping costant is 200 N.s/m.


Since the zeta value is equal 1 , so the system is critically
damped.
The response of the system is given by
x(t) = e^-10.000000t[0.050000 + 0.500000t]

When the value of damping costant is 300 N.s/m.


Since the zeta value is greater than 1 , so the system is
overdamped damped.
The response of the system is given by
x(t) = 0.044721*[1.809017*e^-3.819660t - 0.690983*e^-
26.180340t]>>
0.06
under damped
critically damped
over damped
0.05

0.04

0.03

0.02
x(t)

0.01

-0.01

-0.02

-0.03
0 0.5 1 1.5 2 2.5 3
t
% Question 10
m = input('Enter the value of mass(in kg): ');
k = input('Enter the value of spring constant(in N/m): ');
x0 = input('Enter the value of initial displacement(in m):
');
v0 = input('Enter the value of initial velocity(in m/s): ');
wn = sqrt(k/m);

fprintf('\nThe natural frequency of the system is %f


rad/s\n\n',wn)
c = input('Enter the value of damping constant(in N.s/m):
');
Cc = 2*sqrt(k*m);
zn = c/Cc;

if zn < 1

wd = sqrt(1-z1^2)*wn;
y = z1*wn;
y1 = (v0+z1*wn*x0)/wd;
fprintf(' When the value of damping costant is %f
N.s/m.\n The zeta value is %f less than 1 , so the system
is under-damped.\n',c,zn)
fprintf('The response of the system is given by\n x(t) = e^-
%ft[%fsin(%f) +%fcos(%ft)]\n\n',y,y1,wd,x0,wd)
t = 0:0.01:5;
x1 = (exp(-y.*t)).*y1.*(sin(wd.*t)+x0.*cos(wd.*t));
plot(t,x1)
grid on ;
xlabel('t');
ylabel('x(t)');
legend('under-damped system')
else if zn == 1
y3 = wn*x0;
fprintf(' When the value of damping costant is %f\n Since
the zeta value is equal 1 , so the system is critically
damped.\n',c)
fprintf('The response of the system is given by\n x(t) = e^-
%ft[%f + %ft]\n\n',wn,x0,y3)
t = 0:0.01:5;
x2 = (x0+y3.*t).*exp(-wn.*t);
plot(t,x2)
grid on ;
xlabel('t');
ylabel('x(t)');
legend('critically damped system')
else
y4 = (1/(2*(sqrt(z3^2-1))*wn));
y5 = (v0+(z3+sqrt(z3^2-1))*wn*x0);
y6 = (-z3+sqrt(z3^2-1))*wn;
y7 = (v0+(z3-sqrt(z3^2-1))*wn*x0);
y8 = (-z3-sqrt(z3^2-1))*wn;
fprintf(' When the value of damping costant is %f
N.s/m.\n Since the zeta value is greater than 1 , so the
system is overdamped damped.\n',c)
fprintf('The response of the system is given by\n x(t) =
%f*[%f*e^%ft - %f*e^%ft]',y4,y5,y6,y7,y8)
t = 0:0.01:5;
x3 = y4.*(y5.*exp(y6.*t)-y7.*exp(y8.*t));
plot(t,x3)
grid on ;
xlabel('t');
ylabel('x(t)');
legend('over damped system')

end
end

#output of the programme

Enter the value of mass(in kg): 50


Enter the value of spring constant(in N/m): 1200
Enter the value of initial displacement(in m): 0.5
Enter the value of initial velocity(in m/s): 2

The natural frequency of the system is 4.898979 rad/s

Enter the value of damping constant(in N.s/m): 300


When the value of damping costant is 300.000000 N.s/m.
The zeta value is 0.612372 less than 1 , so the system is
under-damped.
The response of the system is given by
x(t) = e^-1.224745t[0.550736sin(4.743416)
+0.500000cos(4.743416t)]
0.5
under-damped system

0.4

0.3

0.2
x(t)

0.1

-0.1

-0.2

-0.3
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t

You might also like