Question

3. a) Find the solution v ote ordinary diferetinl equation with the initial coditions: b) i) Recast our third ord ODE into aii) Now that you find a first order system of ODEs, you can solve it using the Huerns method ac- cording to the material youdt 0.01. %dt is the numericaL separation in time tmax- 20; syou can play around with this end time t -10 : dt: tmax]; %t is aHow to do question B 2,3,4,5?

3. a) Find the solution v ote ordinary diferetinl equation with the initial coditions: b) i) Recast our third ord ODE into a system af first order ODEs af the formA.v, where v' = dv/dz f(v) and v = (y, y,y")". You should show all working to find the corresponding matrix A. Do not solve the system. 4 mark Solve it only by hand and show your complete work. Do not use a calculator or any symbolic caleu lations). 8 marks i) Show your full work to find the initial condition v(0) to “mplete the initial value problem for the system of first order ODEs. 2 marks
ii) Now that you find a first order system of ODEs, you can solve it using the Huerns method ac- cording to the material you covered in computational module 2. A template of the code which will help you to get started is also available. Attach the complete code as a pdf page to your assignment. 14ark assignment. [1 mark iv) Explain the inluence of the initial conditions on the behaviour of yt). Hint: You can change some of initial conditions in the code to find out how this is relevant for the behaviour of the solution. [1 mark
dt 0.01. %dt is the numericaL separation in time tmax- 20; syou can play around with this end time t -10 : dt: tmax]; %t is a vector containing the t values at which we wiu find y(t) N- length(t); %the number of specific times we want to find the solution at %We first have to recast the problem into set of three first order ODEs To do %this wel set v = [x1,x2,x3] where x1 is y, x2 is dy/dt and x3 is d^2y/dx^2. You did th v = zero s (N,3); %this line makes a vector for all the v vectors we want to tind at eve v(1..) -% ??? Here we store x1(0) and x2(0) and x3(0) as the initial vector-that A = % ??? You might want to store the matrix A from the question to make the proceedi | for i = 2:N %we start our calculation, not at the first point which we just prescribe %you may need to consult your module 2 reading material to remind yourself of how to k1s ??? Note that this will be a vector V1-44% ??? (this is the Euler approximation to the value of V(1)1 k2 = 48% ??? This will also be a vector end plot(t,y)
0 0
Add a comment Improve this question Transcribed image text
Answer #1


)-ヒー 2- So that Rests are nolution t- 96- 2七 2C 5.fg A. 2 So at Укојつ。 2. O O1SMatlab code for Heuns method clear all close all dt-0.01i tmax-20; t-[0:dt:tmax ] N-length(t) v zeros (N, 3) y( 1.. )一0 5-3Solution of y(x) using Heun method Heun Method 一一Exact solution -3 0 24 6 8 10 1 14 16 820 Published with MATLAB R2018a

%%Matlab code for Heun's method
clear all
close all

dt=0.01;
tmax=20;
t=[0:dt:tmax];
N=length(t);

v=zeros(N,3);
v(1,:)=[0 5 -39];

A=[0 1 0;0 0 1;-12 -4 -3];

for i=2:N
  
    K1=dt*A*(v(i-1,:))';
    K2=dt*A*((v(i-1,:)+K1'))';
  
    v(i,:)=v(i-1,:)+(K1'+K2')/2;
  
end

y=v(:,1);

plot(t,y,'Linewidth',2)

%Exact solution
yy=@(tt) -3*exp(-3*tt)+3*cos(2*tt)-2*sin(2*tt);

hold on
plot(t,yy(t),'--')
legend('Heun Method','Exact solution')
title('Solution of y(x) using Heun method')
xlabel('x')
ylabel('y(x)')

grid on

%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
How to do question B 2,3,4,5? 3. a) Find the solution v ote ordinary diferetinl equation with the initial coditions: b)...
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
  • Would someone help me with the last 3 questions here, I got the previous ones but need help with the last 3 in red. Than...

    Would someone help me with the last 3 questions here, I got the previous ones but need help with the last 3 in red. Thank you Transcribed: Now that you nd a rst order system of ODEs, you can solve it using the Huens method ac- cording to the material you covered in computational module 2. A template of the code which will help you to get started is also available. Attach the complete code as a pdf page to...

  • 3. a) Find the solution y(t) of the ordinary differential equation with the initial conditions: (Solve...

    3. a) Find the solution y(t) of the ordinary differential equation with the initial conditions: (Solve it only by hand and show your complete work. Do not use a calculator or any symbolic calu lations). [8 marks b) ) Recast our third order ODE into a system of irst order ODEs of the form A.v, where v' = dv/dr = f(v) and v = (y,y,,y")" . You should show all working to find the corresponding matrix A. Do not solve...

  • Use the attached Matlab code as a basis to solve the following ordinary differential equation usi...

    Question 1 QUESTION 2 Use the attached Matlab code as a basis to solve the following ordinary differential equation using Euler's method, with timestep of 0.1, from t-0to t-100. d)0) -0 - sin (5vt cos(у Plot y versus t from t=0 to t=100. How many local maxima are on this interval(do not include end points). Be careful to count them all! Answer should be an integer 1 w% Matlab code for the solution of Module 2 3 dt-9.1; %dt is...

  • Cosider the second order initial value problem y = y'exp(-3 y) - 2+y+12, 1€ [2,4), y(2)...

    Cosider the second order initial value problem y = y'exp(-3 y) - 2+y+12, 1€ [2,4), y(2) = 3, y' (2) = 1. (a) (1 mark] To convert this into a system of first order ODEs, we introduce *1 = y and *2 = y.Then we obtain the first order system * = 50.0) = (4920:09 where | 12(1,x) fit,x) = x2 f2(t, x) = (Hint: Your expressions should be in terms of t, x] and x2 and should not contain...

  • 1. Solve the initial value problem for a damped mass-spring system acted upon by a sinusoidal...

    1. Solve the initial value problem for a damped mass-spring system acted upon by a sinusoidal force for some time interval f(t) = {10 sin 2t 0 0<t< y(0) 1, y'(0) -5 y"2y' 2y f(t), Tt zusor= 2. Consider two masses and three springs without no external force. The resulting force balance can be expressed as two second order ODES shown as below. mx=-(k k2)x1+ kzx2 m2x2 (k2k3)x2 + k2x1 15 If m 2,m2 ki = 1,k2 = 3, k3...

  • matlab INSTRUCTIONS Consider the spring-mass damper that can be used to model many dynamic systems Applying Newton...

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

  • Moodle Let B={V, V2, Vz) be a basis for Rin which we have: Question 2 Not...

    Moodle Let B={V, V2, Vz) be a basis for Rin which we have: Question 2 Not yet answered Marked out of 12.00 V1 and vg = 0 - Flag question Also, let TR-R be the linear operator such that: 3 T(v.) T(v2) and T(v2) = X1 Part (a): Find a formula for T X2 X3 X Answer: 7 X2 -0 ag, 912 913 X2 where A=221 22 23 = ха 031 32 33 X2 15 Now let the vector w=...

  • In this question, you will need to find the general solution to the equation [i 25...

    In this question, you will need to find the general solution to the equation [i 25 0 2 3 8 -1 || *2 (1 4 9 1] | x4 in vector parametric form. The row reduced echelon form of the matrix [i 25 0 | 2 3 8 -1 | 1 4 9 1 -3 5 [1 0 1 0 1 2 | 0 0 0 0 0 1 2 -2 1 The general solution is X= y + xw,...

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

  • Problem 4. The higher order differential equation and initial conditions are shown as follows: = dy...

    Problem 4. The higher order differential equation and initial conditions are shown as follows: = dy dy +y?, y(0) = 1, y'(0) = -1, "(0) = 2 dt3 dt (a) [5pts. Transform the above initial value problem into an equivalent first order differential system, including initial conditions. (b) [2pts.] Express the system and the initial condition in (a) in vector form. (c) [4pts.] Using the second order Runge Kutta method as follows Ū* = Ūi + hĚ(ti, Ūi) h =...

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