# Code - time2(i = time2(i-1 step2 end step3 = 0.15 interval3...

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

tinitial = 0; tfnal = 3; step1 = .03; interval1 = tfnal/step1; time1 = zeros(1,interval1+1); approx1 = zeros(1,interval1+1); time1(1) = tinitial; approx1(1) = .9; For i = 2:interval1+1 approx1(i) = approx1(i-1) - approx1(i-1)*(1-approx1(i-1))*step1; time1(i) = time1(i-1)+step1; end; step2 = 0.15; interval2 = tfnal/step2; time2 = zeros(1,interval2+1); approx2 = zeros(1,interval2+1); time2(1) = tinitial; approx2(1) = 0.9; For i = 2:interval2+1 approx2(i) = approx2(i-1) - approx2(i-1)*(1-approx2(i-1))*step2;

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: time2(i) = time2(i-1)+step2; end; step3 = 0.15; interval3 = tfnal/step3; time3 = zeros(1,interval3+1); approx3 = zeros(1,interval3+1); time3(1) = tinitial; approx3(1) = 0.9; For i = 2:interval3+1 approx3(i) = approx3(i-1) - approx3(i-1)*(1-approx3(i-1))*step3; time3(i) = time3(i-1)+step3; end; fgure(1); A=plot(time3,approx3,' . ', time2,approx2, '-.',time1,approx1, '--');...
View Full Document

## This note was uploaded on 11/19/2011 for the course MATH 101 taught by Professor Wormer during the Spring '08 term at UCSD.

### Page1 / 2

Code - time2(i = time2(i-1 step2 end step3 = 0.15 interval3...

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

View Full Document
Ask a homework question - tutors are online