[SOLVED] Matlab-: Math 128A Programming assignment 2

$25

File Name: Matlab-:_Math_128A_Programming_assignment_2.zip
File Size: 405.06 KB

5/5 - (1 vote)

Math 128A, Fall 2016.

Programming assignment 2, due Dec 4th. 1. Consider a combustion-type equation:

dy =ay2(1y). dt

Develop a MATLAB function Euler.m to solve this equation using the Euler method of the form

function [ylast] = Euler(t0,y0,tlast,N,a)
  • % t0: initial value of t
  • % y0: initial value of y
  • % tlast: final value of t
  • % ylast: final value of y
  • % N: number of steps in Euler scheme
  • % a: parameter of the problem

    Your program may not use any of the MATLAB built-in functions for solving ODEs.

    2. Develop a MATLAB function RungeKutta.m that solves the same equation using the Runge-Kutta 4 method; the function should be of the form

    function [ylast] = RungeKutta(t0,y0,tlast,N,a)
%t0, y0, tlast, ylast, N,a: same as above

Your program may not use any of the MATLAB built-in functions for solving ODEs.

3. Solve the same equation with t0 = 0, y0 = 0.6, a = 1 by hand exactly. Plot its exact solution on the interval [0, 2000] against its solutions found by Euler.m and RungeKutta.m on the same interval for N = 10, N = 100, N = 1000, N = 10000.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Matlab-: Math 128A Programming assignment 2
$25