diff sample

diff sample - format bank disp( [t' N' Nex'] ) plot(t, N ),...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
h = 0.001; r = 0.9; a = 0; b = 10; m = (b - a) / h; N = zeros(1, m+1); N(1) = 10^11; t = a:h:b; for i = 1:m N(i+1) = N(i) - r * h * N(i); %This line shows diff eqn to iteration end Nex = N(1) * exp(-r * t); %This is the exact solution from analytical integration
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: format bank disp( [t' N' Nex'] ) plot(t, N ), xlabel( 'Hours' ), ylabel( 'left' ) hold on plot(t, Nex ), hold off...
View Full Document

This note was uploaded on 09/15/2011 for the course EE 150 at USC.

Ask a homework question - tutors are online