Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve Example 6.2 on page 111 of textbook, using the 4 th order Runge Kutta method. I HAVE SEEN THE LONG CODE POSTED BY OTHER
Solve Example 6.2 on page 111 of textbook, using the 4th order Runge Kutta method.
I HAVE SEEN THE LONG CODE POSTED BY OTHER USERS, THAT IS NOT CORRECT. IT SHOULD BE A SHORTER CODE. PLEASE DO NOT ANSWER IF YOURE GOING TO COPY AND PASTE THE LONG CODE EVERYONE ELSE HAS POSTED ON HERE.
You can use the results from the code attached below (from the textbook by ODE45 solver) as a reference.
Example 6.2 ode45 ex.m % This program solves a system of 3 differential equations % by using ode45 function clear; clc; initial=[0. O 1.0 1.0]; tspan 0.0:0.1:10.0 options-odeset ('RelTol',1.0e-6, 'AbsTol', [1.0e-6 1.0e-6 1.0e-6]) [t, Y] =ode45 (@dydt3, tspan, initial , options) ; disp (P) yl-P(,2); y2-P(,3) y3-P(,4); fid= fopen ( output. txt, , ,w, ) ; fprintf (fid, ' fprintf (fid,' for i=1:2:101 Y (2) y(3) In') fprintf (fid,, %6.2f %10.2f %10.2f 10.2 n', .. . end fclose (fid); plot (t1,Y(:,1),ti,y(:,2),' - .',tl,Y(:,3),'--'), xlabel('t'), ylabel ('Y(1),Y (2), Y(3)'),title ('Y vs. t') grid text (6.0, -1.2,,y(1),), text (7.7, -0.25,,y(2),), text (4.2,0.85, ,y(3),); % dydt3.m % functions for example problem function Yprime-dydt3 (t, Y) Yprime-zeros (3,1); Yprime (1)-Y (2) *Y (3) *t Yprime (2)Y(1) Y (3) Yprime (3)0.51*Y (1) *Y (2)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started