Question

3. a) Find the solution y(t) of the ordinary differential equation with the initial conditions Solve it only by hand and showWould 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 your
assignment. [4 marks]

Plot the result of your code y(x) in Matlab, label the axes and the curve, attach the plot to your
assignment. [1 mark]

Explain the in uence of the initial conditions on the behaviour of y(t). Hint: You can change
some of initial conditions in the code to nd out how this is relevant for the behaviour of the
solution. [1 mark]

0 0
Add a comment Improve this question Transcribed image text
Answer #1


4 (r-t 3 t- 乇 Эне 2 Le 2 O O 1 And iitra valiue.v(o) 3ツSMatlab 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:
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...
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
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