Week+of+4-8+to+4-14

This post will begin the study of Chapters 13 and 14 as to finish the textbook, which will probably span over the next few weeks. After that is finished, I will feel comfortable moving into some bigger project to end the year. Chapter 13 is a jumble of graphical capabilities of MATLAB. The first topic discussed is logarithmic plots. These are the plots used in math and physics to compress gigantic data sets or sometimes used to linearize data sets. There are three commands that dominate the creation of logarithmic plots. 'semilogx' and 'semilogy' will cause their respective axes to be turned logarithmic, and leave the other axis scaled normally. The 'loglog' function graphs both axes as logarithmic. The other concept addressed in this section is the "LATEX" formatting system. This is a format that can be applied when displaying strings onto a plot that can handle special mathematical and scientific notations and symbols. It will display Greek letters and the like, and can be very useful when trying to display certain functions and values. The book does not dive deep into the specifics of how to make LATEX formatting do everything you want it to, but shows examples of how to write Greek letters such as tau and sigma. The second section is about comparing two functions of different units. The author intelligently points out that often, the relationship between two variables is made shockingly clear by seeing them graphed next to each other. For example, position and velocity are especially nifty when plotted next to each other, because velocity is a simple derivative of position, so the relationship is not made so crystal clear to the normal eye from numbers, but on a graph it is surprisingly obvious. The problem is that velocity and position have clearly different units - meters, and meters/second - so they cannot just be plopped on the same set of axes. So, MATLAB has this nifty little function, 'plotyy', that puts the proper y-axis for the first line on the left y-axis, and puts the proper axis for the second line on another y-axis on the right side of the graph. This way, both lines are in the same space, but the scale by which each is progressing and the units of each line are clear. The third section discusses the plotting of a "surface". I had never really understood the concept of a surface or thought of the way that relationship might work until reading this section - each point in the flat x-y plane is assigned a height, or z-value, of how far above or below the 0 height of the plane it should be raised or lowered, and thus the flat sheet of the x-y plane is morphed into some kind of surface. The main commands for creating surfaces are 'surf' and 'meshgrid'. 'meshgrid' is the command used to create the grid of x and y coordinates to base the z coordinates off of. The idea is that two values are stored in a matrix for each significant point in the plane. The x matrix will have each column be a certain number, and the y matrix will have each row be a certain number, and when they are combined they make a sort of modified coordinate plane. Then the z function will draw off of each of those points and eventually when it is made into a matrix to be put into the 'surf' command, each z-value will be in the position in the z-matrix corresponding to its proper position in the meshgrid. Another useful command is 'rotate3d', which allows the user to move the figure around with the mouse to view it from different angles. Additionally, 'colormap' could be used to change the way that the colors spread out across the picture. Below is the code and display for a simple little surface plot I made. I then moved it around a bit with the mouse to show the rotation aspect. I then showed the ability to smooth out the graphics with the 'shading interp' command line. Note that in all of these pictures MATLAB's shading convention has used blue to represent the low values and red to represent the high values, with the spectrum in between. Next I plotted this function with the 'pcolor' command - this one is essentially the same color shading that is on the surfaces in the pictures above, but on the flat 2D x-y plane. Finally, I graphed it using the 'contour' function, which displays it like a contour map - the closer the lines are bunched together, the higher the spot is.

Finally, I looked at section 13.4. This section deals with vector fields. I am familiar with slope fields from BC Calculus, and this probably would have been a relatively handy thing to check out when I was learning those. The 'quiver' command is MATLAB's function for plotting vector fields. The 'quiver' command takes four inputs - x and y arrays in a meshgrid like the 'surf' commands asked for, and an array of x-components and an array of y-components for each of the vectors corresponding to those coordinates. It would be fun to try and stumble through an attempt at graphing an interesting vector field, but it would likely be pretty time consuming. That pretty much wraps up this post. Next post will wrap up Chapter 13 and begin Chapter 14.