Question

Check the file: Questions.pdf

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

% Usage: [y tme] = rkf45_mod(f,a,b,ya,h,rtol,atol,flg)
% Runge-Kutmea-Fehlberg 4th Order/5th Order embedded pair
%
% Input:
% f - ODE function f(t,y)
% a,b - Time interval of integration
% ya - initial condition
% h - initial step-size
% rtol - relative error tolerance per step
% atol - Absolute Error Vector
%
% Output:
% y - computed solution
% tme - time vector
%
% Examples:
% [y t]=rkf45(@myode,0,10,[1 0 0],1E-2,1e-1,1e-4);    -Here, 'myode' is a user-defined function in M-file of the required ODE system

function [y,tme] = rkf45_mod(f,a,b,ya,h,rtol,atol,flg)
%Fehlberg RK45 Butcher Tableau coefficients
c10 = 0;
c20 = 1/4;    c21 = 1/4;
c30 = 3/8;    c31 = 3/32;      c32 = 9/32;
c40 = 12/13; c41 = 1932/2197; c42 = -7200/2197; c43 = 7296/2197;
c50 = 1;      c51 = 439/216;   c52 = -8;          c53 = 3680/513;    c54 = -845/4104;
c60 = 1/2;    c61 = -8/27;    c62 = 2;          c63 = -3544/2565; c64 = 1859/4104; c65 = -11/40;
%4th order coefficients
cw1 = 25/216; cw2 = 0;         cw3 = 1408/2565;   cw4 = 2197/4104;   cw5 = -1/5;      cw6 = 0;
%5th order coefficients
cz1 = 16/135; cz2 = 0;         cz3 = 6656/12825; cz4 = 28561/56430; cz5 = -9/50;    cz6 = 2/55;
%Error Coefficients
ce1 = 1/360; ce2 = 0;         ce3 = -128/4275;   ce4 = -2197/75240; ce5 = 1/50;      ce6 = 2/55;
% Numerical Parameters
alph = 0.8; k = 0;
% Initial time moment
i = 1; tme(1) = a; t = a;
% Initial condition
y(1,:) = ya; y0 = ya;
% If it is the last iteration, then l_it = 1, othery0se l_it = 0
l_it = 0;
if flg==1%Perform 4th Order RK
    while l_it == 0...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Gerontology Questions
Homework Solution
$20.00
Administration
Gerontology
Grandparent
Grandchild
Convoy
Hillier
Barrow
Era
Bykota
Newsletter
Disorders Of The Blood And Blood-Forming Organs
Homework Solution
$10.00
Health Administration
Carcinoma
Hemoglobin
ICD-9-Codes
Breast
Pulmonary Disease
Biopsy
Axillary Lymph Node
Peripheral Vein
Hospital
Infusion
Coagulation Factors
Hemophilia
Rheumatoid Arthritis
Microsoft Excel Questions
Homework Solution
$40.00
Microsoft Excel
Administration
Queries
Tables
Functions
Documents
Workbooks
Cells
Comments
Shapes
Rows
Columns
Constraints
Analysis Tools
Variables
Reports
Trial and Error
Numerical Methods for Engineers
Homework Solution
$90.00
Mathematics
Computer Science
Netwton-Rapshon Algorithm
Roots
Functions
Derivative
Regions
Signs
Intervals
Zeros
Singularity
Divergence
Triangular Matrix
Linear Systems
Variables
Statements
Loops
International Relations Discussion (650 words)
Homework Solution
$20.00
Administration
International Relations
Discussion
Female Leaders
Gender Stereotypes
Marketing
Leadership Skills
Government
Politics
Indira Gandhi
Angela Merkel
Hillary Clinton
Awards
Ceremonies
Social Activities
Get help from a qualified tutor
Live Chats