hw10_p02 - clc c clear h = input('h: '); ca(1) =...

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

View Full Document Right Arrow Icon
clc clear c h = input('h: '); ca(1) = input('ca(1): '); cb(1) = input('cb(1): '); cc(1) = input('cc(1): '); tmin = input('t_min: '); tmax = input('t_max: '); t=tmin:h:tmax; t int_1 = 10; i %We need to get a total of 4 starting values for AB4-AM4, so we use RK4 to %get the next 3 after the initial (given) value. Recycling the function %from part (a): for i=2:4 [ca(i), cb(i), cc(i)] = hw10_p02RK4(h,t(i-1),ca(i-1),cb(i-1),cc(i-1)); end e %Get c?_prime values for the points already calculated: for i=1:4 ca_prime(i) = -10*ca(i)*cc(i) + cb(i); cb_prime(i) = 10*ca(i)*cc(i) - cb(i); cc_prime(i) = -10*ca(i)*cc(i) + cb(i) - 2*cc(i); end e for i=5:length(t) %AB4 predictor. We'll store these predictions in the c? arrays, then %overwrite them with the corrected values later: [ca(i), cb(i), cc(i)] = hw10_p02AB4(i,h,ca(i-1),cb(i-1),cc(i- 1),ca_prime,cb_prime,cc_prime); %We'll store the estimates for the c?_prime values at the current point %in the fprime arrays for now to make writing the AM4 function easier
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 02/22/2010 for the course CHE 348 taught by Professor Chelikowsky during the Spring '08 term at University of Texas at Austin.

Page1 / 2

hw10_p02 - clc c clear h = input('h: '); ca(1) =...

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