Question

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:

of 5 (underdamped), 40 (critically damped), and 200 (over- damped). The spring constant k-20 N/m. The initial ve- locity is z

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 zero, and the initial displacement r- 1 m. Solve this equation using a numerical method over the time period 0
0 0
Add a comment Improve this question Transcribed image text
Answer #1


Matlab code for solving ode clear all close all tAnswering question %Initial conditions for ode x0 10]; SAll parameter valuesPlot for x(t) vs. t -c:40. C-200 0.8 0.6 0.4 0.2 -0.2 -0.4 -0.6 15 -0.8 0 10 time Plot for dx(t)/dt vs. t 0.6 -C15. C-40. C-2

%%Matlab code for solving ode
clear all
close all
%Answering question
%Initial conditions for ode
x0=[1;0];
%All parameter values
k=20;m=20;c=[5 40 200];
for i=1:3
        %minimum and maximum time span
        tspan=[0 15];
        %Solution of ODEs using ode45 matlab function
        sol= ode45(@(t,u) odefcn(t,u,m,c(i),k), tspan, x0);
        %Equally splitting time
        t1 = linspace(tspan(1),tspan(end),1001);
        %x is the corresponding value for x(1) and x(2)
        xx1 = deval(sol,t1);
      
        legendinfo{i}=sprintf('C=%d.\n',c(i));
        %plotting x1(t) vs t
        figure(1)
        hold on
        plot(t1,xx1(1,:),'Linewidth',2)
        title('Plot for x(t) vs. t')
        xlabel('time')
        ylabel('x(t)')
        box on
      
        %plotting x2(t) vs t
        figure(2)
        hold on
        plot(t1,xx1(2,:),'Linewidth',2)
        title('Plot for dx(t)/dt vs. t')
        xlabel('time')
        ylabel('dx(t)/dt')
        box on
end  
figure(1)
legend(legendinfo)
figure(2)
legend(legendinfo)
%-----------------------------------------------------------------%
%Function for evaluating the ODE
function dudt = odefcn(t,x,m,c,k)

    eq1 = x(2);
    eq2 = (-c/m)*x(2)-(k/m)*x(1);
    %Evaluate the ODE for our present problem
    dudt = [eq1;eq2];
end
%-----------------------------------------------------------------%

Add a comment
Know the answer?
Add Answer to:
I want matlab code. 585 i1 FIGURE P22.15 22.15 The motion of a damped spring-mass system (Fig. P22.15) is de...
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
  • Solve it with matlab 25.16 The motion of a damped spring-mass system (Fig. P25.16) is described...

    Solve it with matlab 25.16 The motion of a damped spring-mass system (Fig. P25.16) is described by the following ordinary differential equation: d’x dx ++ kx = 0 m dr 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 (under- damped), 40 (critically damped), and 200 (overdamped). The spring constant k = 20 N/m....

  • SOLVE NUMERICALLY USING EULERS METHOD

    The motion of a damped spring-mass system (Fig. P25.16)  is described by the following ordinary differential equation: m d2x dt2 1 c dx dt 1 kx 5 0 where x 5 displacement from equilibrium position (m), t 5 time  (s), m 5 20-kg mass, and c 5 the damping coeffi cient (N ? s/m).  The damping coeffi cient c takes on three values of 5 (underdamped), 40 (critically damped), and 200 (overdamped). The  spring constant k 5 20 N/m. The...

  • 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...

  • 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...

  • 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...

  • 2 with spring stiffness k 1000 N/m, Consider a mass-spring-damper system shown in Figure mass m...

    2 with spring stiffness k 1000 N/m, Consider a mass-spring-damper system shown in Figure mass m = 10 kg, and damping constant c-150 N-s/m. If the initial displacement is xo-o and the initial velocity is 10 m/s (1) Find the damping ratio. (2) Is the system underdamped or overdamped? Why? (3) Calculate the damped natural frequency (4) Determine the free vibration response of the system.

  • A mass weighing 4 pounds stretches a spring 6 inches. At time t = 0, the...

    A mass weighing 4 pounds stretches a spring 6 inches. At time t = 0, the weight is then struck to set it into motion with an initial velocity of 2 ft/sec, directed downward. Determine the equations of motion for the position and the velocity of the weight. Find the amplitude, period, and frequency of the position (displacement). A 4-lb weight stretches a spring 1 ft. If the weight moves in a medium where the magnitude of the damping force...

  • A damped system consists of a mass (m = 30kg) supported on a spring and a...

    A damped system consists of a mass (m = 30kg) supported on a spring and a damper in parallel. In an experiment, the period of vibration of this system was measured to be 0.5 seconds, and the ratio of maximum displacement between two successive cycles was determined from the experimental data to be 20. Determine: a. The logarithmic decrement. [2] Q4a. Answer: b. The damping ratio, commenting if this is over-damped, critically damped, or under-damped. [4] Q4b. Answer: c. The...

  • 3. The motion of a 1DOF mass-spring-damper system (see Figure 1) is modeled by the following seco...

    3. The motion of a 1DOF mass-spring-damper system (see Figure 1) is modeled by the following second order linear ODE: dx,2 dt n dt2 (0) C dt where is the damping ratio an wn is the natural frequency, both related to k, b, and m (the spring constant, damping coefficient, and mass, respectively) (a) Use the forward difference approximations of (b) Using Δt andd to obtain a finite difference formula for x(t+ 2Δ) (like we did in class for the...

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