Week+of+1-7+to+1-13

January 7th and 8th
It's time to dive into the two chapters I skipped leading into break: 6 and 7. Chapter 6, upon a glance, appears it might be the slowest chapter I've encountered yet because it looks like a bunch of stuff I've never dealt with before, as well as lots of stuff unique to MATLAB. In section 6.1, the author discusses the way things can be animated in MATLAB - 'for' loops which redraw a plot slightly differently every execution. The key command that lets this happen is the 'drawnow' command, which forces the computer to redraw the plot rather than adding a bunch of images all on top of each other. The section builds with a few examples that culminate at an example that draws a circle along with the axes and the circle's radius from the most recent point by using parametric functions. Rather than recycle one of the examples, I chose to do my own little thing, shown below. The little bit of scrolling at the beginning is to show all the code since it doesn't quite fit in the window, and I ran the program twice because it goes by pretty quickly. media type="custom" key="21876414" Rather than just portray parabolic motion, I decided to (if pretty roughly) add in the element of a wind blowing to the left as the projectile travels through the air to spice things up. I suppose "Windy Toss" may have been a more fitting title, but "Friction" is meant to be air friction. Regardless, I followed a few traditions of the framework presented in the textbook I found especially useful. The structural order of the code of separating it into sections of setting governing parameters, initializing arrays, calculating the motion and thus populating the arrays, then finally performing the animation (or some nuance of this order) is an intuitive way to organize the code, and makes it easily digest-able. Using 'Nt' as the variable for number of time steps seems intuitive enough, so I picked up the author's habit. In writing the code I learned the use of sticking an axis setting in the 'for' loop because I had some times in my testing where only a portion of the flight path would show up. One very minor lesson I learned was scaling an array of four numbers to make the axis settings because in most situation that will save typing when you are fiddling around with it, especially if the numbers are very big or very small. Section 6.2 is about animating functions. One of the example pieces of code in this section totally went over my head, so I decided to copy it down and execute it myself. (I apologize for the awkward video-inside-a-video) media type="custom" key="21876276" The main idea of this section is to show the usefulness of animating the progression of a function's graph by each time graphing everything up to that point, and then the new point. This example was particularly vexing to me because I've never seen a strip chart represented by mathematical equations. Regardless, it's fascinating to watch that graph unfold. One interesting visual thing this graph does is display a point at the end of the graph as well as displaying the function up to the point. The little circle gives an easy way to follow the progression. The other fascinating feature of this graph aside from the math of creating the functions (which frankly goes over my head) is the dynamic scaling of the axes. The use of 'max' in a negative set of numbers rather than min in a positive mirror-image of those numbers is an interesting idea to note, and just generally the built-in check to make sure the scale is as big as it needs to be but also not too big is a very cool aspect of this program. Section 6.3 is about the kinematics of motion. The physics and math side is pretty simple, and the programming part merely builds off the previous two (mostly my first one). So, I made an example modeling a ball that was thrown 33 m/s at an angle of 55 degrees upward from the ground media type="custom" key="21877046". The addition of 'Tf' was a good one because it allows the programmer to pick a time frame that will let the math work as in a normal problem and at the same time split the interval up into many many parts for a detailed animation. Most of the variables, etc. are self explanatory. The book was using the method they call a "time march" in which velocity is calculated at each step, and then from that position is calculated, but I was not quite sold on this idea and stuck with the standard x=x0+v0t+.5at^2 equation to calculate the position in one fell swoop. For situations like this one, the permanent scale that encompasses just more space than the function will occupy is fitting, rather than the complex, dynamic scale in the strip chart. Two other features of 6.3 I have not included are bouncing in parabolic motion (which essentially consists of reversing the velocity when y=0, assuming elasticity) and situations involving non-constant force. The non-constant force just adds another level to the calculations, and I didn't want to waste time on that for now. With that, I conclude chapter 6. I was at QuarkNet from 4:20-6:00 on the 7th and 4:10-6:30 on the 8th.