{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Cheat sheet - Exam 1

Cheat sheet - Exam 1 - Loops Euler's RK2 for...

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

View Full Document Right Arrow Icon
Loops: Euler’s RK2: for k1 (i,:)=h*de(t(i),Run1(i,:),K)'; k2(i,:)=h*de((t(i)+h/2),(Run1(i,:)+k1(i,:)/2),K)'; Run1(i+1,:)=Run1(i,:)+k2(i,:); End; Simpsons: ( 29 ( 29 1 2 3 4 5 3 2 1 ; ( ) 4 ( ) 2 ( ) 4 ( ) 2 ( ) 2 ( ) 4 ( ) ( ) h n n n S f P f x f x f x f x f x f x f x f x - - = + + + + + + + + L e venvectors=conc(2:2:(n-1)); oddvectors=conc(3:2:(n-1)); even=4*evenvectors; odd=2*oddvectors; Simpsons=(h/3)*(conc(1)+sum(even)+sum(odd)+conc(end)); Trapezoidal: ( 29 ( 29 ( 29 ( 29 ( 29 1 1 2 2 ; n h n i i T f P f x f x h f x - = = + + Trapezoidal=(h/2)*(conc(1)+conc(end))+h*((sum(conc)-conc(1)-conc(end))); Rectangular: ( 29 1 1 ( ; ) n i i R f P h f x - = = Rectangular=h*(sum(conc)-conc(end)); Matlab functions: Trapz: trapzfunc=trapz(time,conc); spline: xx=[0:.1:12]; yy=spline(time,conc, xx); plot(time,conc, 'o' , xx, yy, '-' ); ODE45: options =odeset( 'Reltol' , 1e-5, 'AbsTol' ,1e-5); [T1,x11]=ode45( 'dede' ,[0 20],Run1(1,:),options,K); [T2,x22]=ode45( 'dede' ,[0 20],Run2(1,:),options,K); Euler’s: x ( t + h ) = x ( t ) + h f ( x ( t ), t ) RK2: Implicit Euler’s: Function file: Cardiac Output: T 0 D c(t)dt Q=
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern