While commands could be entered line by line into MATLAB's interactive environment,
it is generally easier to write a script (i.e., program) of MATLAB
commands which would be located in a file which by convention ends with ".m",
e.g., *plate.m* would be a script, run with the command **plate**, that calculates and
displays this temperature field.

My plate.m file (located in /usra/mcduff/oc540) is:

`kappa=25;` | set the numerical values of parameters |

`z=0:5e3:1e5` | create vector of depths, z, in increments of 5000 m (5 km) to 100 km depth |

`t=0:5e6:1e8` | create vector of times, t, in increments of 5 My to 100 My |

`for I=1:1:21` | use the index I for depth and loop over the 21 values |

`T(I,0)=Tmelt;` | to avoid the singularity at t=0, use the boundary condition |

`for J=2:1:21` | use the index J for the time and loop over the remaining 21 elements |

`T(I,J)=Tmelt*erf(z(I)/2*sqrt(kappa*t(J))));` | calculate the temperature for the Ith depth and the Jth time |

`end` | close the time loop |

`end` | close the depth loop |

`contour(t,-z,T);` | contour the temperature T as a function of t and -z (to have depth increase downward) |

Oceanography 540 Pages Pages Maintained by Russ McDuff (mcduff@ocean.washington.edu) Copyright (©) 1994-2001 Russell E. McDuff and G. Ross Heath; Copyright Notice Content Last Modified 1/4/2001 | Page Last Built 1/4/2001 |