{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ASE 311 HW #12 - tS enErrS 2 dT/dx = q dq/dx =.15 T...

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

View Full Document Right Arrow Icon
ASE 311 HW #12 1.) mass = 1; kspring = 1; y0 = [1,0]; tspan = [0, 50*pi]; nsteps = 2000; [tR,yR,en,enErrR] = rk4ODE(@massSpring1, @massSpring1en, tspan, y0, nsteps, kspring, mass); [tS,yS,en,enErrS] = stormerODE(@massSpring1, @massSpring1en, tspan, y0,4*nsteps, kspring, mass); yExactS = cos(tS); yExactR = cos(tR); figure(1) plot(tS,yExactS-yS(:,1)') figure(2) plot(tR,yExactR-yR(:,1)'); figure(3) plot(tS,enErrS) figure(4) plot(tR,enErrR) If we were to run each method for a much larger ending time, by observing the graphs of the methods, we can see that the Runge-Kutta would give us a better trajectory, while the Stormer-Verlet method better conserve energy.
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
0 20 40 60 80 100 120 140 160 -5 -4 -3 -2 -1 0 1 2 3 4 5 x 10 -5 Trajectory Error Runge-Kutta tR yExactR-yR
Image of page 2
0 20 40 60 80 100 120 140 160 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 x 10 -3 Trajectory Error Stormer-Verlet tS yExact-yS
Image of page 3

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

View Full Document Right Arrow Icon
0 20 40 60 80 100 120 140 160 -7 -6 -5 -4 -3 -2 -1 0 x 10 -6 Energy Error Runge-Kutta tR enErrR
Image of page 4
0 20 40 60 80 100 120 140 160 -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0 x 10 -4 Energy Error Stormer-Verlet
Image of page 5

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

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

Unformatted text preview: tS enErrS 2.) dT/dx = q dq/dx = .15 * T function df = heat(x,y) df=[ y(2); .15*(y(1))]; function b = bal(qp) [x,y]=ode45(@heat,[0 10], [240 qp]); b = y(length(x),1) - 150; >> fzero(@bal , -90) ans =-86.5858 >> [x,y] = ode45(@heat, [0 10], [240 fzero(@bal,-90)]); >> plot(x, y(:,1)) >> fzero(@bal,-90) ans =-90.6147 >> [x,y] = ode45(@heat,[0 10],[240 fzero(@bal, -90)]); 1 2 3 4 5 6 7 8 9 10 40 60 80 100 120 140 160 180 200 220 240 >> plot(x,y(:,1)) >> v = [2.15 -1 0 0 0 0 0 0 0; -1 2.15 -1 0 0 0 0 0 0; 0 -1 2.15 -1 0 0 0 0 0; 0 0 -1 2.15 -1 0 0 0 0; 0 0 0 -1 2.15 -1 0 0 0; 0 0 0 0 -1 2.15 -1 0 0; 0 0 0 0 0 -1 2.15 -1 0; 0 0 0 0 0 0 -1 2.15 -1; 0 0 0 0 0 0 0 -1 2.15]; >> w = [240 0 0 0 0 0 0 0 150]'; >> T = v \ w T = 165.7573 116.3782 84.4558 65.2018 55.7281 54.6136 61.6911 78.0223 106.0569 T(0) = 240 T(10) = 150 1 2 3 4 5 6 7 8 9 10 40 60 80 100 120 140 160 180 200 220 240...
View Full 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