MATLAB solvers for first-order IVP

Assignment Help Simulation in MATLAB
Reference no: EM131858750

MATLAB solvers for First-Order IVP

In this laboratory session we will learn how to

1. Use MATLAB solvers for solving scalar IVP

2. Use MATLAB solvers for solving higher order ODEs and systems of ODES.

EXERCISES

Instructions: For your lab write-up follow the instructions of LAB 1.

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) = yj(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.

1050_Time series.jpg

Figure L4g: Time series y = y(t) and v = v(t) = y'(t) (left), and phase plot v = y' vs. y for (L4.7).

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

EXERCISES

2. (a) Consider the modified problem

d2y/dt2 + 7y2.dy/dt + 5y = sint, with y(0) = -0.5, dy/dt(0) = 0.5

The ODE (L4.7) is very similar to (L4.4) except for the y2 term in the left-hand side. Because of the factor y2 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 am- plitude of oscillations.

(d) Modify LAB04ex2.m so that it solves (L4.7) using Euler's method with N = 1000 in the interval 0 ≤ t ≤ 50 (use the file euler.m from LAB 3 to implement Euler's 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 Euler's 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

d2y/dt2 + 7y.dy/dt + 5y = sint, 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

figure(2); plot3(y,v,w,'k.-');

grid on; view([-40,60])
xlabel('y'); ylabel('v=y'''); zlabel('w=y''''');

1763_Time series1.jpg

Figure L4i: Time series y = y(t), v = v(t) = y'(t), and w = w(t) = y'(t) (left), and 3D phase plot v = y' vs. y vs w = y'' for (L4.8) (rotated with view = [-40,60]).

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: Sub- stitute t = 0 into (L4.7) and use the initial conditions for y and v.

Reference no: EM131858750

Questions Cloud

Discuss the different types of sampling techniques : Discuss the different types of sampling techniques that are used in field research.
How does select an appropriate forecasting method : What should be considered in selecting an appropriate forecasting method? What do you think about combining statistical forecasts and judgment?
Evaluate the effectiveness of the leader : Evaluate the effectiveness of the leader within your example using either expectancy or equity theory.
Analysis of delinquency theories and causation : Include an analysis of delinquency theories and causation. Why do juveniles commit crimes? What are some of the theories?
MATLAB solvers for first-order IVP : MAT 275 - MATLAB solvers for First-Order IVP - Use MATLAB solvers for solving higher order ODEs and systems of ODES.
What do you think would be a successful approach : Offender re-entry is not a new phenomenon ... in your opinion what is working and what is not? What do you think would be a successful approach.
Discuss what the greeks got right and wrong about politics : Discuss what the Greeks got right and wrong about politics and order before Solon, Plato and Aristotle
How does the media and use of video technology : How does the media and use of video technology impact the public's perception of police use of force?
Describe how and why the leaders use of leadership theories : Justify a recommendation, using specific examples, of how the leader could have behaved differently within each role to be more effective.

Reviews

Write a Review

Simulation in MATLAB Questions & Answers

  Simulate 16-qam system without grey coding

Simulate and compare the BER of a 16-PSK system and a 16-QAM system without Grey coding and Eb/N0=0,2,4,6,8,10 dB. "

  Use the matlab program to simulate an open loop system

For this laboratory you will use the MATLAB program to simulate an open loop system. You are to determine the system response to a step and sinusoidal input. Each student will be assigned a specific system Your system transfer function is

  Find the roots for polynomials shown using matlab

INLAB Report (1): Find the roots for polynomials shown above using MATLAB. Can you guess a function which finds "roots" for polynomials in MATLAB? Use help in MATLAB to find the syntax for function

  Design the controller using the root locus method

For the feedback control system shown below with the process TF, Gp(s) = [10/(s+30)(s2+30s+709)], and for a step input command, design the controller Gc(s), Using the Root Locus method and Using the PID controller

  Simulate the CSTR described in example

For part 2 you need to determine the PI parameters, Kc and tI, using any one of the tuning methods covered in this course

  Determine the impulse response of system

Determine the impulse response of system - Determine the stiffness constant (stiffness ratio)of Goust(s).

  Describe both the hydraulic press and control valve

Formulate a solution to the diffusion equation using an explicit method and develop a Matlab script file implementing this explicit method - Develop a Simulink model which describes both the hydraulic press and control valve.

  Build a matlab based graphical user interface

Build a Matlab based graphical user interface (GUI) that operates in conjunction with a base Matlab/ Simulink simulation program. Any base simulation is considered acceptable.

  Water reservoir problem

MECH304 Applied Numerical Engineering Assignment. Find the value of h necessary for achieving a velocity of v=(x+2) m/sec at time t = 3 sec when L = 5m

  What is the expression for the diagonal terms

What is the expression for the diagonal terms in the resulting matrix of coefficients of the tridiagonal system of linear equations that has to be solved

  Write down the velocity of collar

Write down the velocity of collar C in terms of the variables (r1; _1) and their time derivatives. Similarly, write down the velocity of collar C in terms of the variables (r2; _2) and their time derivatives

  Use matlab to plot the periodic square wave

Use MATLAB to plot the periodic square wave 5 f(t) over the time interval 0 ≤ t ≤ 3T  . On the same graph, plot the output waveforms, f0(t), of the two amplifiers with corner frequencies of F =  10I and F = 40I, respectively.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd