Question
matlab

INSTRUCTIONS Consider the spring-mass damper that can be used to model many dynamic systems Applying Newtons Second Law to a
Task 2: MATLAB ODE solvers, as well as the ones we write, expect a function defining the system of ODEs to be in a specific f
INSTRUCTIONS Consider the spring-mass damper that can be used to model many dynamic systems Applying Newton's Second Law to a free-body diagram of the mass m yields the following ODE m습+8 +kx=F(t) (1) dt2 Where F() is a forcing function, Consider the case where the forcing function itself is a damped oscillation: Where F F(t)-Ae-Bt COS(wt) (2) For this activity we'll see how we can formulate this ODE for a solution using MATLAB that could be used to study the sensitivity of the system to changes in any of the parameter values. Task 1: Define two new variables yi and y,--. The resulting relationship between yi and y2 gives us the first equation in the system of first order ODEs that is equivalent to equation (1): dt yi dt Note this equation will ALWAYS be the first ODE in the system of first order ODEs written to be equivalent to ANY higher order ODE. Next use the definitions of y and yz to substitute for any terms involving x in equation (1) such that the only derivative term in the equation is Solve the equation for dy2. This is the dy2 dt second equation in the system.
Task 2: MATLAB ODE solvers, as well as the ones we write, expect a function defining the system of ODEs to be in a specific format that outputs a column vector of evaluations of the derivatives given inputs t and a vector of y values for the current time step. Write (by hand) a MATLAB anonymous function to define this system of ODEs in this format. You can assume the parameters of the system have values in the workspace OR include them as function inputs in the appropriate position in the input list.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The system of ODEs is

\dot{y}_1=y_2

F(t) kB 7m

Write the following in a file called Dydx.m

function DX=Dydx(t,x)
global k A B m omega
DX=[x(2) ; A*exp(-B*t).*cos(omega*t)-k*x(1)/m-B*x(2)/m];
end

_________________________

The following in a separate file.

global m B k A omega
m=input('Enter the mass: ');
B=input('Damping: ');
k=input('Spring Constant: ');
x0=input('Initial position: ');
A=input('Enter force amplitude: ');
omega=input('Omega: ');
Tspan=[0 10];
[t, x]=ode45(@(t,x)Dydx(t,x),Tspan,[x0; 0]);
plot(t,x(:,1))
xlabel('Time, t','fontsize',14)
hold on
plot(t,x(:,2))
legend('Displacement','Velocity');
D=B^2-4*k*m;
if D>0
fprintf('\nSystem is overdamped.\n');
elseif D==0
fprintf('\nSystem is critically damped.\n');
else
fprintf('\nSytem is underdamped.\n');
end

Add a comment
Know the answer?
Add Answer to:
matlab INSTRUCTIONS Consider the spring-mass damper that can be used to model many dynamic systems Applying Newton...
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
  • help me with this. Im done with task 1 and on the way to do task...

    help me with this. Im done with task 1 and on the way to do task 2. but I don't know how to do it. I attach 2 file function of rksys and ode45 ( the first is rksys and second is ode 45) . thank for your help Consider the spring-mass damper that can be used to model many dynamic systems -- ----- ------- m Applying Newton's Second Law to a free-body diagram of the mass m yields the...

  • Problem #3: The Ralston method is a second-order method that can be used to solve an...

    Problem #3: The Ralston method is a second-order method that can be used to solve an initial-value, first-order ordinary differential equation. The algorithm is given below: 2 Yi+1 = yi + k +k2)h Where kı = f(ti,y;) 3 k2 = ft;+ -h, y; +-kih You are asked to do the following: 3.1 Following that given in Inclass activity #10a, develop a MATLAB function to implement the algorithm for any given function, the time span, and the initial value. 3.2 Use...

  • Problem Set A Problem 6. (20%) A ordinary differential equation for a mass-damper-spring system is following....

    Problem Set A Problem 6. (20%) A ordinary differential equation for a mass-damper-spring system is following. The mass m 1, damping coetfic e initial position y(o) O, and the initial velocity i constant k 3 and force 10, all are in appropriate units. Th 1, spring zero, within the time range of O to 20 unit of time, use Matlab find the solution of function y(t)? Hint: you need to convert the 2nd order ODE into two 1st order ODEs....

  • PLEASE ONLY ANSWER THIS QUESTION IF YOU COULD GIVE ME THE MATLAB CODE.THANK YOU. THIS IS...

    PLEASE ONLY ANSWER THIS QUESTION IF YOU COULD GIVE ME THE MATLAB CODE.THANK YOU. THIS IS THE FULL QUESTION GIVEN. dyi Consider the following Ordinary Differential Equation (ODE) for function yı (2) on interval [0, 1] dayi dyi +(-9.7) * + 28.64 * dr3 d. 2 dar + (-23.828) * yı (x) = -5.18 0.9-2 with the following initial conditions at point x 0: dyi dy yi = -4.98 = 1.168 26.8052 dar Introducting notations dyi dy2 dayı Y2 =...

  • dy: 2 Consider the following Ordinary Differential Equation (ODE) for function yı(z) on interval [0, 1]...

    dy: 2 Consider the following Ordinary Differential Equation (ODE) for function yı(z) on interval [0, 1] +(-10,3) dayi dy + 28.06 + (-16.368) + y(x) = 1.272.0.52 with the following initial conditions at point a = 0; dy 91 = 4.572 = 30.6248 = 185.2223 dar Introducting notations dyi dy2 dy dar dar dir? convert the ODE to the system of three first-order ODEs for functions y1, y2, y3 in the form: dy dar fi (1, y1, ya, y) dy2...

  • PLEASE PLEASE,ONLY ANSWER THIS QUESTION IF YOU COULD GIVE ME THE MATLAB CODE.THANK YOU. dyi y...

    PLEASE PLEASE,ONLY ANSWER THIS QUESTION IF YOU COULD GIVE ME THE MATLAB CODE.THANK YOU. dyi y = 2.5. dy Consider the following Ordinary Differential Equation (ODE) for function yı(a) on interval [0, 1] dyi dayı dyi d3 + (-3.3) * + 2.9 * + (-0.6) * yı(20) = 0.0 dar2 da with the following initial conditions at point x = 0: dayı = 8.86 = 18.248 dar dra Introducting notations dyi dy2 y2 = da da d2 convert the ODE...

  • A. 1st Order Systems Consider the spring-damper system shown in Figure 1. Figure 1: spring-damper system...

    A. 1st Order Systems Consider the spring-damper system shown in Figure 1. Figure 1: spring-damper system (1)Draw FBD and deduce EOM. Clearly state your assumptions. (2)Cast EOM as an ODE in standard form; write the time constant T and the forcing function f(t) in terms of k,c, f*(1) (3) Write the solution x(t) as the sum x(t) = x (1)+x,() and do the following: a) give the name of x (1) b) write the equation that x(!) must satisfy and...

  • Hello These are a math problems that need to solve by MATLAB as code Thank you...

    Hello These are a math problems that need to solve by MATLAB as code Thank you ! Initial Value Problem #1: Consider the following first order ODE: dy-p-3 from to 2.2 with y() I (a) Solve with Euler's explicit method using h04. (b) Solve with the midpoint method using h 0.4. (c) Solve with the classical fourth-order Runge-Kutta method using 0.4 analytical solution of the ODE is,·? solution and the numerical solution at the points where the numerical solution is...

  • Model for Evaluation The model used for evaluation is the single degree of freedom lumped mass mo...

    Model for Evaluation The model used for evaluation is the single degree of freedom lumped mass model defined by second order differential equation with constant coefficients. This model is shown in Figure 1. x(t)m m f(t) Figure 1 - Single Degree of Freedom Model The equation of motion describing this system can easily be shown to be md-x + cdx + kx = f(t) dt dt where m is the mass, c is the damping and k is the stiffness...

  • a can be skipped Consider the following second-order ODE representing a spring-mass-damper system for zero initial...

    a can be skipped Consider the following second-order ODE representing a spring-mass-damper system for zero initial conditions (forced response): 2x + 2x + x=u, x(0) = 0, *(0) = 0 where u is the Unit Step Function (of magnitude 1). a. Use MATLAB to obtain an analytical solution x(t) for the differential equation, using the Laplace Transforms approach (do not use DSOLVE). Obtain the analytical expression for x(t). Also obtain a plot of .x(t) (for a simulation of 14 seconds)...

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