In this laboratory we will examine harmonic oscillation. We will model the motion of a mass-springsystem with differential equations.Our objectives are as follows:1. Determine the effect of parameters on the solutions of differential equations.2. Determine the behavior of the mass-spring system from the graph of the solution.3. Determine the effect of the parameters on the behavior of the mass-spring.The primary MATLAB command used is the ode45 function.Mass-Spring System without DampingThe motion of a mass suspended to a vertical spring can be described as follows. When the spring isnot loaded it has length 0 (situation (a)). When a mass m is attached to its lower end it has length (situation (b)). From the first principle of mechanics we then obtain|m{zg}downward weight force+ k( 0) | {z }upward tension force= 0. (L5.1)The term g measures the gravitational acceleration (g 9.8m/s2 32ft/s2). The quantity k is a springconstant measuring its stiffness. We now pull downwards on the mass by an amount y and let the massgo (situation (c)). We expect the mass to oscillate around the position y = 0. The second principle ofmechanics yields|m{zg}weight+ k( + y 0) | {z }upward tension force= md2( + y)dt2 | {z }acceleration of mass, i.e., md2ydt2 + ky = 0 (L5.2)using (L5.1). This ODE is second-order.(a) (b) (c) (d)y0mkEquation (L5.2) is rewrittend2ydt2 + 20y = 0 (L5.3)c2011 Stefania Tracogna, SoMSS, ASUMATLAB sessions: Laboratory 5where 20 = k/m. Equation (L5.3) models simple harmonic motion. A numerical solution with initialconditions y(0) = 0.1 meter and y(0) = 0 (i.e., the mass is initially stretched downward 10cmsand released, see setting (c) in figure) is obtained by first reducing the ODE to first-order ODEs (seeLaboratory 4).Let v = y. Then v = y = 20y = 4y. Also v(0) = y(0) = 0. The following MATLAB programimplements the problem (with 0 = 2).function LAB05ex1m = 1; % mass [kg]k = 4; % spring constant [N/m]omega0 = sqrt(k/m);y0 = 0.1; v0 = 0; % initial conditions[t,Y] = ode45(@f,[0,10],[y0,v0],[],omega0); % solve for 0<t<10y = Y(:,1); v = Y(:,2); % retrieve y, v from Yfigure(1); plot(t,y,b+-,t,v,ro-); % time series for y and vgrid on;%function dYdt = f(t,Y,omega0)y = Y(1); v = Y(2);dYdt = [ v ; -omega0^2*y ];Note that the parameter 0 was passed as an argument to ode45 rather than set to its value 0 = 2directly in the function f. The advantage is that its value can easily be changed in the driver part of theprogram rather than in the function, for example when multiple plots with different values of 0 needto be compared in a single MATLAB figure window.0 1 2 3 4 5 6 7 8 9 100.20.150.10.0500.050.10.150.2Figure L5a: Harmonic motion1. From the graph in Fig. L5a answer the following questions.(a) Which curve represents y = y(t)? How do you know?(b) What is the period of the motion? Answer this question first graphically (by reading theperiod from the graph) and then analytically (by finding the period using 0).(c) We say that the mass comes to rest if, after a certain time, the position of the mass remainswithin an arbitrary small distance from the equilibrium position. Will the mass ever come torest? Why?c2011 Stefania Tracogna, SoMSS, ASUMATLAB sessions: Laboratory 5(d) What is the amplitude of the oscillations for y?(e) What is the maximum velocity (in magnitude) attained by the mass, and when is it attained?Make sure you give all the t-values at which the velocity is maximum and the correspondingmaximum value. The t-values can be determined by magnifying the MATLAB figure usingthe magnify button , and by using the periodicity of the velocity function.(f) How does the size of the mass m and the stiffness k of the spring affect the motion?Support your answer first with a theoretical analysis on how 0 and therefore the periodof the oscillation is related to m and k, and then graphically by running LAB05ex1.m firstwith m = 5 and k = 4 and then with m = 1 and k = 16. Include the corresponding graphs.2. The energy of the mass-spring system is given by the sum of the potential energy and kineticenergy. In absence of damping, the energy is conserved.(a) Plot the quantity E = 12mv2 + 12ky2 as a function of time. What do you observe? (pay closeattention to the y-axis scale and, if necessary, use ylim to get a better graph). Does the graphconfirm the fact that the energy is conserved?(b) Show analytically that dEdt = 0.(Note that this proves that the energy is constant).(c) Plot v vs y (phase plot). Does the curve ever get close to the origin? Why or why not? Whatdoes that mean for the mass-spring system?Mass-Spring System with DampingWhen the movement of the mass is damped due to viscous effects (e.g., the mass moves in a cylindercontaining oil, situation (d)), an additional term proportional to the velocity must be added. Theresulting equation becomesmd2ydt2 + cdydt+ ky = 0 ord2ydt2 + 2pdydt+ 20y = 0 (L5.4)by setting p = c2m. The program LAB05ex1 is updated by modifying the function f:function LAB05ex1am = 1; % mass [kg]k = 4; % spring constant [N/m]c = 1; % friction coefficient [Ns/m]omega0 = sqrt(k/m); p = c/(2*m);y0 = 0.1; v0 = 0; % initial conditions[t,Y] = ode45(@f,[0,10],[y0,v0],[],omega0,p); % solve for 0<t<10y = Y(:,1); v = Y(:,2); % retrieve y, v from Yfigure(1); plot(t,y,b+-,t,v,ro-); % time series for y and vgrid on;%-function dYdt = f(t,Y,omega0,p)y = Y(1); v = Y(2);dYdt = [ v ; ?? ]; % fill-in dv/dt3. Fill in LAB05ex1a.m to reproduce Fig. L5b and then answer the following questions.(a) For what minimal time t1 will the mass-spring system satisfy |y(t)| < 0.01 for all t > t1? Youcan answer the question either by magnifying the MATLAB figure using the magnify button(include a graph that confirms your answer), or use the following MATLAB commands(explain):c2011 Stefania Tracogna, SoMSS, ASUMATLAB sessions: Laboratory 50 1 2 3 4 5 6 7 8 9 100.20.150.10.0500.050.10.150.2y(t)v(t)=y(t)Figure L5b: Damped harmonic motionfor i=1:length(y)m(i)=max(abs(y(i:end)));endi = find(m<0.01); i = i(1);disp([|y|<0.01 for t>t1 with num2str(t(i-1)) <t1< num2str(t(i))])(b) What is the maximum (in magnitude) velocity attained by the mass, and when is it attained?Answer by using the magnify button and include the corresponding picture.(c) How does the size of c affect the motion? To support your answer, run the file LAB05ex1.mfor c = 2, c = 4, c = 6 and c = 8. Include the corresponding graphs with a title indicatingthe value of c used.(d) Determine analytically the smallest (critical) value of c such that no oscillation appears inthe solution.4. (a) Plot the quantity E = 12mv2 + 12ky2 as a function of time. What do you observe? Is theenergy conserved in this case?(b) Show analytically that dEdt < 0 for c > 0 while dEdt > 0 for c < 0.(c) Plot v vs y (phase plot). Comment on the behavior of the curve in the context of the motionof the spring. Does the graph ever get close to the origin? Why or why not?c2011 Stefania Tracogna, SoMSS, ASU
Matlab Programming
[Solved] MAT 275 Laboratory 5 The Mass-Spring System
$25
File Name: MAT_275_Laboratory_5_The_Mass-Spring_System.zip
File Size: 405.06 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.