We learned that taking numerical derivatives is not generally a good idea, especially if there is noise in the data. Instead, you should try to do a good fit to the data and look at the slope of that. Sometimes there isn't a single good function to fit to though. For the first half of this assignment, you will write a function that could deal with that. Write a function called boxcarDeriv that takes vectors for x and y as well as a number, n, that is the size of the "boxcar". This function will return arrays for x and dy/dx. The trick is that it will pull n consecutive values from x and y and do a linear fit to those points, then return the slope of that fit. So the returned x values will be the average x value in the boxcar while the dy/dx value is the slope of the fit over each grouping of points.
To complete the assignment I want you to use ode45 to solve a differential equation. The equation that you will look at is a very commonly referenced one called the Lorenz equations. The solution is what is known as the Lorenz attractor. There at three equations, given below.
dX/dt=s(Y-X)
dY/dt=-XZ+rX-Y
dZ/dt=XY-bZ
You can play with different values of the constants s, r, and b. You can start with values along the lines of s=10, r=28, and b=2.7 with initial conditions of X=-10, Y=20, and Z=-5. Play with this system and plot it up some.