# main16 - ... rinit = sqrt(512/8)=8 % r/x = rinit/xinit =...

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

% % Derek Rampal % HW # 16 % 8a, 14 % clear; c % test % 1a % y' = t*exp(3*t) - 2*y, for 0<=t<=1 with y(0) = 0 and h = .5 % %a0=0; %b0=1; %initval0=0; %h0=.5; %functest = inline('t*exp(3*t) - 2*y','t','y'); %array1 = rkmid(functest,a0,b0,initval0,h0) %seems to work. % %8a ffun = inline('y/t-(y/t)^2','t','y'); fact = inline('t/(1+log(t))','t'); a1 = 1.0; b1 = 2.0; initval1 = 1; h1 = 0.1; h eighta(:,2) = rkmid(ffun,a1,b1,initval1,h1); e for i = 0:(b1-a1)/h1 eighta(i+1,1)=a1+i*h1; eighta(i+1,3)=fact(a1+i*h1); [eighta(i+1,6),eighta(i+1,4),eighta(i+1,5)]=sigdig(eighta(i+1,3),eighta(i+1,2)) ; end; e eighta e %14 initvol = ((512/3)*pi); xinit = 8; t0=0; t1=10*60; h2=20; h % vinit= 1/3 *pi *rinit^2*h .

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: ... rinit = sqrt(512/8)=8 % r/x = rinit/xinit = 8/8=1 (conical shape) % r(t) = x(t) % A(t) = pi * r^2(t) % A(t) = pi* (x(t))^2 % gfun = inline('-.6*pi*(.1)^2*sqrt(-2*-32.17)*sqrt(x)/(pi*x^2)','t','x'); g % changed final time to 100000000 mins so it will loop a while and then % added the break for the loop within the rkmid function to create % rkmidbreak % fourteenn = rkmidb(gfun,t0,100000000,xinit,h2); [m,n]=size(fourteenn); for i = 1:m if(mod(i-1,3)==0) fourteen((i-1)/3+1,1) = (i-1)/3; fourteen((i-1)/3+1,2) = fourteenn(i,1); end; end; fourteen(27,1)=25.20; fourteen(27,2)=fourteenn(25*3+2,1); f fourteen...
View Full Document

## This note was uploaded on 09/19/2009 for the course MATH numerical taught by Professor Ford during the Spring '09 term at FAU.

### Page1 / 2

main16 - ... rinit = sqrt(512/8)=8 % r/x = rinit/xinit =...

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

View Full Document
Ask a homework question - tutors are online