Starting from:
$30

$24

Scientific Computing Assignment 5 Solution

Note: Please do your programming in Matlab and document thoroughly! The code must compile on one of the lab machines with your instructions.

Instructions

1. Solve the coffee cup problem analytically for 5 minutes based upon Newton's law of cooling:

dTc = --r(Tc –Ts)

dT




Ts=19C, Tc = 84C, r - .0.25/second







By making sure the supplied program runs using Matlab. Write the function Tsexact which is the analytical solution for use in the supplied matlab code. Use the solution to the in class activity to help you write this function.




2. Using the supplied program to solve the coffee cup problem using the Forward Euler Method calculate and compare your results to the analytical answer given by the provided

function.


ℎ (ℎ =

Plot the results for all algorithms using several different values for the step size

Using these results estimate the order of the error after the first step






30 , 15 , 10 , 5 , 1 , 0.5 , 0.25 )
and at the end of


the integration. Describe how the error changes with changes in ℎ. Use a graph


Implement the ODE23 method described in the book Moler in the test program you have been given . For the standard equation dy/dt = f(t,y) (note y here is Tc above) the method is given by

S1 = f(tn,yn)



S2 = f(tn + h/2, yn+h/2 S1)



S3 = f(tn + 3h/4, yn+3h/4 S2)



tn+1 = tn + h



yn+1 = yn + h/9 ( 2S1 + 3S2 + 4S3)



S4 = f(tn+1, yn+1)



Errorn+1 = h/72 ( -5S1 + 6S2ℎ ℎ =
30Plot, the15 results,10, 5for, this1, 0algorithms.5,0.25) using several different values for the step size (+8S3-9S4)



Using these results estimate the order of the error after the first step and at the end of the integration. Compare the actual error on the first step with the predicted error on the first step.



Change the value of r in the problem being solved to r = 0.6. Does the error estimator blow up in the same way as the solution when the solution becomes unstable?



What to turn in




For these assignments, we expect both SOURCE CODES and a written REPORT be uploaded as a zip or tarball file to Canvas.




Source code for all programs that you write, thoroughly documented.



o Include a README file describing how to compile and run your code.




Your report should be in PDF format and should stand on its own. o It should describe the methods used.
o It should explain your results and contain figures. o It should also answer any questions asked above.




o It should cite any sources used for information, including source code. o It should list all of your collaborators.




This homework is due on April 14th by 11:59 pm. If you don't understand these directions, please send questions to teach-cs3200@list.eng.utah.edu or come see one of the TAs or the instructor during office hours well in advance of the due date.
















































































































2

More products