Euler the right way

Euler the right way - % % % % % % % % % % % % % % % % % % %...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% % EULER.M Use Euler Method for Numerical Solution of IVPs % % This function file is modeled after the example in by Edwards and % Penny (see pg. 105). However it is designed to handle vector functions. % % The inputs to the function are: % fxy = string variable with the name of the function file containing f(x,y) % xo,xf = initial and final values of the independent variable (scalars) % yo = initial value of dependent variable at xo (column vector) % N = number of intervals to use between xo and xf % % The outputs to the function are: % X = vector containing values of the independent variable % Y = the estimated dependent variable at each value of the independent variable % --> this variable is a vector if only one equation is solved % --> it is a matrix [y1(x) y2(x) . .. ] for multiple equations % % File prepared by J. R. White, UMass-Lowell (March 1998) % function [X,Y] = euler(fxy,xo,xf,yo,N) % % compute step size and size of output variables if N < 2 N = 2; end % set minimum number for N h = (xf-xo)/N; % step size X = zeros(N+1,1); % initialize independent variable
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/01/2009 for the course PSTAT 120A taught by Professor Mackgalloway during the Spring '08 term at UCSB.

Page1 / 3

Euler the right way - % % % % % % % % % % % % % % % % % % %...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online