 # Numerical Analysis MATLAB Questions

## Question

Numerical Solutions to Ordinary Differential Equations
Problems:
1. Write a user defined function euler(f, a, b, N, α) that outputs a vector w = (wi) = (w0, w1, . . . , wN ) of Euler approximations at the points tᵢ
2. Consider the IVP below

dx             x
--- = 3t − ---               1 ≤ t ≤ 6
dt             t

x(1) = 2

The solution to this IVP is x(t) = t² + 1/t.

(a) Determine the rate of convergence to its solution (demonstrate numerically) using the classical Runge-Kutta scheme
(b) Approximate the solution using your euler function with stepsize h = .02 and RK4 with stepsizes h = .02 and h = .2. Plot the solution function and these three approximations on one figure. Any observations?
(c) Determine the rate of convergence to its solution (demonstrate numerically)using the classical Runge-Kutta scheme if the initial value is x(1) = 1 instead. The exact solution in this case is x(t) = t²
(d) Is there a difference in the rate of convergence? If so, explain why that might be.

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

function [t, w] = euler( f,a,b,N,alpha )
%[ w] = euler( f,a,b,N,alpha )
%INPUTS
% f -- function f(t,x)
% a -- begin point interval
% b -- end points interval
% N -- number of steps
% alpha -- initial condition x(a)
%OUTPUTS
% t -- the vector of times t_i
% w -- the vector of solutions at the times t_i

h=(b-a)/N;
w(1)=alpha;
for i=1:N+1;...
\$33.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Numerical Analysis Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.