Homework #5

All problems MUST be in a SINGLE *.m file and be in separate blocks using '%% Problem X'. Otherwise you will not receive credit. You will need additional files for the class definitions. Include your ODE solver class definition. See class webpage for naming convention.

Contents

Problem 1

Create a class called 'XX_Planet'. This class will have at least these properties:

a;          % semi-major axis (AU)
epsilon;    % eccentricity
T;          % Period (Years)
aphelion;   % (AU)
perihelion  % (AU)

For Problem 1, Display the class definition in the command window using 'type'. This class should perform the functionality requested in Problem 2-4

Problem 2

For 'XX_Planet', create a class constuctor that takes 'a', and 'epsilon' as inputs, to be set as properties, and also calculates and sets 'T', 'aphelion','perihelion'.

Show this works using the values for Earth. Display the object properties in the command window.

Problem 3

For 'XX_Planet', add a method that uses your ODE solver's RK4 method to find the trajectory and velocity of the planet for the number of years specified as an input arguement to the method. Store the results in class properties. State what you are using for initial conditions.

Problem 4

Assume Pluto is a planet. Use 9 instances of 'XX_Planet' to find the orbits and velocities for each planet for 10 Earth Years. Make a single movie showing all planets moving in thier orbits for 10 years. Indicate the changing time on the plot using the 'text' command.

Problem 5

Use your ODE solver to find the scattering angle as a function of impact parameter for Rutherford scattering of alpha particles from gold. Use initial velocities consistant with the original experiments. Plot your simulation results as red circles and the known theoretical result as a black line.