Math 308, Matlab assignment 3 due October 21 in class 1. A mass of 1 kg is attached to an (idealized) spring with the spring constant 100 N/m2 and zero damping. The mass is at rest at the equilibrium position of the spring. Then, starting at time 0, an external force cos 9t is applied to the mass. (a) Use dsolve to find the position of the mass as a function of time. Write down the formula in your report. (b) Use ezplot to plot your solution on the interval [−10, 10]. If you do this correctly, you should observe the phenomenon of “beats”. It is encountered in practice with speakers that have feedback. 2. A mass of 1 kg is attached to a spring with the spring constant 5 N/m2 and the damping constant 2 N/m. The mass is at rest at the equilibrium position of the spring. Then, starting at time 0, an external force cos t is applied to the mass. (a) dsolve does not work on this problem (try it if you want), so we will have to use a numerical solver ode45. First, we need to write the second order ODE my 00 + by 0 + ky = F (t) as a system of two first-order ODE u01 = u2 , k 1 b u02 = − u2 − u1 + F (t). m m m 0 where u1 = y, u2 = y . Now we create an M-file (see Assignment 2) function uprime = Exc32(t,u) uprime = zeros(2,1); uprime(1) = u(2); uprime(2) = -(b/m)*u(2) - (k/m)*u(1) + (1/m)*cos(t); and save it as Exc32.m (or whatever name you want to use). In the actual file you will use the numeric values of m, k, b, or you can choose to pass them in as parameters. (b) Now use ode45 on the interval [0, 20] (again, see Assignment 2) to solve the system; the syntax is [t,u] = ode45(...,[0;0]) where [0; 0] are the initial conditions for u1 = y and u2 = y 0 . We can extract just u1 from u by using u(:,1). (c) By the method of undetermined coefficients, we can find a particular solution 1 1 (1) yp (t) = sin t + cos t. 10 5 This is exactly the steady state solution (why?). On one plot, graph the full solution, the steady state solution, and the transient solution (which you need to find first, but since you know the full solution and the steady-state solution, that is easy). Make sure to label the graphs. 1 3. A mass of 1 kg is attached to a spring with the spring constant 1 N/m2 and the damping constant b N/m. The mass is at rest at the equilibrium position of the spring. Then, starting at time 0, an external force cos t is applied to the mass. Note that for b = 0, the resonance frequency of the system is 1. (a) Write the corresponding M-file for the function Exc33(t,u,b), where b is passed in as a parameter. (b) For b = 0.5, compute the solution on the interval [0, 100] using [t,u]=ode45(@Exc33,[0,100],[0;0],[],0.5); and plot t versus u(:,1). From the plot, what is the frequency gain (you do not need to find it precisely)? (c) Redo part (b) for b = 0.1. What is the frequency gain?