Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (a) Modify the function ex with 2eqs to solve the IVP (L4.4) for 0 t 50 using the MATLAB routine ode45. Call the new

1. (a) Modify the function ex with 2eqs to solve the IVP (L4.4) for 0 t 50 using the MATLAB routine ode45. Call the new function LAB04ex1. Let [t,Y] (note the upper case Y) be the output of ode45 and y and v the unknown functions. Use the following commands to define the ODE: function dYdt= f(t,Y) y=Y(1); v=Y(2); dYdt = [v; sin(t)-7*v-5*y]; Plot y(t) and v(t) in the same window (do not use subplot), and the phase plot showing v vs y in a separate window. Add a legend to the first plot. (Note: to display v(t) = y 0 (t), use v(t)=y(t)). Add a grid. Use the command ylim([-1.2,1.2]) to adjust the y-limits for both plots. Adjust the x-limits in the phase plot so as to reproduce the pictures in Figure L4g. Include the M-file in your report.

Time series y = y(t) and v = v(t) = y 0 (t) (left), and phase plot v = y 0 vs. y

(b) For what (approximate) value(s) of t does y reach a local maximum in the window 0 t 50? Check by reading the matrix Y and the vector t. Note that, because the M-file LAB04ex1.m is a function file, all the variables are local and thus not available on the Command Window. To read the matrix Y and the vector t, you need to modify the M-file by adding the line [t Y]. Do not include the whole output in your lab write-up. Include only the values necessary to answer the question. (c) What seems to be the long term behavior of y? (d) Modify the initial conditions to y(0) = 2, v(0) = 3 and run the file LAB04ex1.m with the modified initial conditions. Based on the new graphs, determine whether the long term behavior of the solution changes. Explain. Include the pictures with the modified initial conditions to support your answer.

2. (a) Consider the modified problem d 2y dt2 + 7y 2 dy dt + 5y = sin t, with y(0) = 0.5, dy dt (0) = 0.5. (L4.7) The ODE (L4.7) is very similar to (L4.4) except for the y 2 term in the left-hand side. Because of the factor y 2 the ODE (L4.7) is nonlinear, while (L4.4) is linear. There is however very little to change in the implementation of (L4.4) to solve (L4.7). In fact, the only thing that needs to be modified is the ODE definition. Modify the function defining the ODE in LAB04ex1.m. Call the revised file LAB04ex2.m. The new function M-file should reproduce the pictures in Fig L4h. Include in your report the changes you made to LAB04ex1.m to obtain LAB04ex2.m. (b) Compare the output of Figs L4g and L4h. Describe the changes in the behavior of the solution in the short term. (c) Compare the long term behavior of both problems (L4.4) and (L4.7), in particular the amplitude of oscillations. (d) Modify LAB04ex2.m so that it solves (L4.7) using Eulers method with N = 1000 in the interval 0 t 50 (use the file euler.m from LAB 3 to implement Eulers method; do not delete the lines that implement ode45). Let [te,Ye] be the output of euler, and note that Ye is a matrix with two columns from which the Eulers approximation to y(t) must be extracted. Plot the approximation to the solution y(t) computed by ode45 (in black) and the approximation computed by euler (in red) in the same window (you do not need to plot v(t) nor the phase plot). Are the solutions identical? Comment. What happens if we increase the value of N? Include the modified M-file in your report.

3. Solve numerically the IVP d 2y dt2 + 7y dy dt + 5y = sin t, with y(0) = 0.5, dy dt (0) = 0.5 in the interval 0 t 50. Include the M-file in your report. Is the behavior of the solution significantly different from that of the solution of (L4.7)? Is MATLAB giving any warning message? Comment.

4. (a) Write a function M-file that implements (L4.8) in the interval 0 t 50. Note that the initial condition must now be in the form [y0,v0,w0] and the matrix Y, output of ode45, has now three columns (from which y, v and w must be extracted). On the same figure, plot the three time series and, on a separate window, plot the phase plot using Do not forget to modify the function defining the ODE. The output is shown in Fig. L4i. The limits in the vertical axis of the plot on the left were deliberately set to the same ones as in Fig. L4h for comparison purposes using the MATLAB command ylim([-1.2,1.2]). Include the M-file in you report. (b) Compare the output of Figs L4h and L4i. What do you notice? (c) Differentiate the ODE in (L4.7) and compare to the ODE in (L4.8). (d) Explain why the solution of (L4.7) also satisfies the initial conditions in (L4.8). Hint: Substitute t = 0 into (L4.7) and use the initial conditions for y and v. image text in transcribed

Consider the third-order IVP +5dt = cost, with y(0)=-0.5, (0)=0.5, (0)=1.625. (L4.8) dt Introducing u-d u(0) = and w = d' we obtain 0.5 and w(0)-(0)-1.625. Thus (L4.8) is equivalent to = w and 7t_ cos t-7y2W-14yv2-DU. Moreover, (0) (0)0.5, u(0)=0.5, w(0) dt with dt (L4.9) = cost-7y2w-14yy2-5U 1.625 Consider the third-order IVP +5dt = cost, with y(0)=-0.5, (0)=0.5, (0)=1.625. (L4.8) dt Introducing u-d u(0) = and w = d' we obtain 0.5 and w(0)-(0)-1.625. Thus (L4.8) is equivalent to = w and 7t_ cos t-7y2W-14yv2-DU. Moreover, (0) (0)0.5, u(0)=0.5, w(0) dt with dt (L4.9) = cost-7y2w-14yy2-5U 1.625

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions