Question

3. Write a program called VibratingSystem that does the following a. Takes the following as input i. Spring constant, k; ii.

This two problems go together

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB program:

prompt = 'Enter the value of spring constant';
k = input(prompt);
if k <= 0
prompt = 'Enter correct value of k again';
k = input(prompt);
end
prompt = 'Enter the value of mass';
m = input(prompt);
if m <= 0
prompt = 'Enter correct value of m again';
m = input(prompt);
end
prompt = 'Enter the value of coefficient of viscous damping';
c = input(prompt);
prompt = 'Enter the initial position';
x0 = input(prompt);
prompt = 'Enter the initial velocity';
v0 = input(prompt);
w_n = sqrt(k/m);
zeta = c/(2*sqrt(m*k));
t = 0:0.05:20;
if c == 0
x = x0 * cos(w_n .* t) + (v0/w_n)*sin(w_n.*t);
plot(t,x);
ylabel('Displacement');
xlabel('Time');
title('Undamped');
end
if zeta < 1
w_d = sqrt(1 - zeta^2)*w_n;
x = exp(-zeta*w_n.*t).*(x0*cos(w_d.*t) + ((v0+zeta*x0*w_n)/(w_d)).*sin(w_d.*t));
plot(t,x);
ylabel('Displacement');
xlabel('Time');
title('Underdamped');
  
elseif zeta == 1
x = (x0 + (v0 + zeta*w_n).*t).*exp(-w_n.*t);
plot(t,x);
ylabel('Displacement');
xlabel('Time');
title('Critically damped');
else
C1 = (xo*w_n*(zeta + sqrt(zeta^2 - 1)) + v0)/(2*w_n*sqrt(zeta^2-1));
C2 = ((-1)*xo*w_n*(zeta - sqrt(zeta^2 - 1)) - v0)/(2*w_n*sqrt(zeta^2-1));
x = C1*exp((-zeta + sqrt(zeta^2 - 1)*w_n.*t)) + C2*exp((-zeta - sqrt(zeta^2 - 1)*w_n.*t));
plot(t,x);
ylabel('Displacement');
xlabel('Time');
title('Overdamped');
end

OUTPUT:

Enter the value of spring constant50
Enter the value of mass20
Enter the value of coefficient of viscous damping10
Enter the initial position0.5
Enter the initial velocity1

0.8 Underdamped 0.6 0.4 0.2 -0.2 0.2 -0.4 0.6 0 268 10 12 14 16 18 20 Time

Add a comment
Know the answer?
Add Answer to:
3. Write a program called VibratingSystem that does the following a. Takes the following as input...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This two problems go together 3. Write a program called VibratingSystem that does the following a....

    This two problems go together 3. Write a program called VibratingSystem that does the following a. Takes the following as input i. Spring constant, k; ii. Mass under vibration, m; iii. Coefficient of viscous damping, c, iv. Initial position of the mass. xi, v. And initial velocity of the mass. vi b. If the values k or m are less than or equal to zero, ask for those variables again. c. Plot the results for t from 0 to 20...

  • A damped osillator has a mass (m = 2.00kg), a spring (k = 10.0N/m), and a...

    A damped osillator has a mass (m = 2.00kg), a spring (k = 10.0N/m), and a damping coefficient b = 0.102kg/s. undamped angular frequency of the system is 2.24rad/s. If the initial amplitude is 0.250m, How many periods of motion are necessary for the amplitude to be reduced to 3/4 it initial value? is this system underdamped, critically damped, or overdamped

  • Answer last four questions 1. A spring-mass-damper system has mass of 150 kg, stiffness of 1500...

    Answer last four questions 1. A spring-mass-damper system has mass of 150 kg, stiffness of 1500 N/m and damping coefficient of 200 kg/s. i) Calculate the undamped natural frequency ii) Calculate the damping ratio iii) Calculate the damped natural frequency iv) Is the system overdamped, underdamped or critically damped? v) Does the solution oscillate? The system above is given an initial velocity of 10 mm/s and an initial displacement of -5 mm. vi) Calculate the form of the response and...

  • 1) Answer the following questions for harmonic oscillator with the given parameters and initial c...

    1) Answer the following questions for harmonic oscillator with the given parameters and initial conditions Find the specific solution without converting to a linear system Convert to a linear system Find the eigenvalues and eigenvectors of the corresponding linear system Classify the oscillator (underdamped, overdamped, critically damped, undamped) (use technology to) Sketch the direction field and phase portrait Sketch the x(t)- and v(t)-graphs of the solution a. b. c. d. e. f. A) mass m-2, spring constant k 1, damping...

  • A mass m is attached to both a spring (with given spring constant k) and a...

    A mass m is attached to both a spring (with given spring constant k) and a dashpot (with given damping constant c). The mass is set in motion with initial position X, and initial velocity vo Find the position function x(t) and determine whether the motion is overdamped, critically damped, or underdamped. If it is underdamped, write the position function in the form x(t) =C, e-pt cos (0,t-a). Also, find the undamped position function u(t) = Cocos (0,0+ - )...

  • MATLAB HELP (a) Use the command dsolve to find general solutions to the differential equations below. i. y 00 + 3y = 0 i...

    MATLAB HELP (a) Use the command dsolve to find general solutions to the differential equations below. i. y 00 + 3y = 0 ii. y 00 + 4y 0 + 29y = 0 iii. y 00 − y/36 = 0 iv. y 00 + 2y 0 + y = 0 v. y 00 + 6y 0 + 5y = 0 (b) Graph each of the solutions in (a) in the same window with 0 ≤ t ≤ 10, using the...

  • Item 13 This question is about the homogeneous spring-mass model mj + y+ky 0. (a) Let...

    Item 13 This question is about the homogeneous spring-mass model mj + y+ky 0. (a) Let m 10, u37, and k= 30. Which case is this, and how do you know? (By "which case is this," I mean, "Is the system undamped, underdamped, critically damped, or overdamped?") (b) Suppose m 10, 0, and k30. Which case is this, and how do you know? (c) Suppose now that m 10, 20, and k30. Which case is this, and how do you...

  • 6. A mass of 2 kilogram is attached to a spring whose constant is 4 N/m, and the entire system is...

    6. A mass of 2 kilogram is attached to a spring whose constant is 4 N/m, and the entire system is then submerged in a liquid that inparts a damping force equal to 4 tines the instantansous velocity. At t = 0 the mass is released from the equilibrium position with no initial velocity. An external force t)4t-3) is applied. (a) Write (t), the external force, as a piecewise function and sketch its graph b) Write the initial-value problem (c)Solve...

  • I want matlab code. 585 i1 FIGURE P22.15 22.15 The motion of a damped spring-mass system (Fig. P22.15) is de...

    I want matlab code. 585 i1 FIGURE P22.15 22.15 The motion of a damped spring-mass system (Fig. P22.15) is described by the following ordinary differ- ential equation: dx dx in dt2 dt where x displacement from equilibrium position (m), t time (s), m 20-kg mass, and c the damping coefficient (N s/m). The damping coefficient c takes on three values of 5 (underdamped), 40 (critically damped), and 200 (over- damped). The spring constant k-20 N/m. The initial ve- locity is...

  • A spring-mass-dashpot system for the motion of a block of mass m kg is shown in...

    A spring-mass-dashpot system for the motion of a block of mass m kg is shown in Fig. II-2. The block is moved to the right of the equilibrium position and is released from rest (time t = 0) when its displacement, x = XO. Using the notations given in Fig. II-2,4 (1) Draw the free body diagram of the block - (2) Write the equation of motion of the block- If the initial displacement of the block to the right...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT