ME 218 HW 10 - plot(x,z); 2.(y(0)= .1563 tspan = [ 0, 1];...

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

View Full Document Right Arrow Icon
Greg Gangluff ME 218 HW 10 T 1-3 1. hw10a.m function zprime = hw10a(x,z) h=.01;Ta=20; T=z(1); tdot=z(2); zprime = [tdot; h*(T-Ta)]; hw10b.m clear all ; clf xspan=[0 10]; T0= 40; t0=10; [x,z] = ode45( 'hw10a' , xspan, [T0 t0]); y=z(:,1); a=y(length(x)) xspan=[0 10]; T0= 40; t1=20; [x,z] = ode45( 'hw10a' , xspan, [T0 t1]); y=z(:,1); b=y(length(x)) Xm=(200*(t1-t0)+(t0*b - t1*a))/(b-a); T0= 40; t2=Xm; [x,z] = ode45( 'hw10a' , xspan, [T0 t2]); y=z(:,1); c=y(length(x))
Background image of page 1

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

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

Unformatted text preview: plot(x,z); 2.(y(0)= .1563 tspan = [ 0, 1]; i=0; y1 = 0; [x,z]=ode45( 'mySystem' ,tspan,[y1, 0]); y=z(:,2); a=y(length(x)) y2 = 1; [x,z]=ode45( 'mySystem' ,tspan,[y2, 0]); y=z(:,2); b=y(length(x)) while (i<5) y0=(y1+y2)/(2); [x,z]=ode45( 'mySystem' ,tspan , [y0,0]); y=z(:,2); c=y(length(x)); if ( c*a < 0) y2 = y0; b = c; else y1 = y0; a=c; end i = i +1; end plot(x,z); legend( 'y' , 'y0' ); y0...
View Full Document

This note was uploaded on 06/23/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas at Austin.

Page1 / 3

ME 218 HW 10 - plot(x,z); 2.(y(0)= .1563 tspan = [ 0, 1];...

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

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