Week+of+11-12+to+11-18

November 13th
I arrived at QuarkNet at 4:00 today. I lost some time in confusion because I tried MATLAB on a few computers and every time it asked me for an activation key. I was perplexed because I remembered using MATLAB on one specific computer and I got the activation key message on that computer, too. After being thoroughly stumped I decided to see if I could find some online things to teach me the basics of MATLAB in addition to the help program in MATLAB itself. I found a couple PDF books online that appear they will be very useful. After reading the introduction of one book explaining how MATLAB is a time-saving graphical computational tool that is widely used by engineers, I decided to take another stab at opening up MATLAB. Then I realized my mistake. I had been trying to open 2011 MATLAB when in reality the computer I had worked on before actually has a 2012 copy that's not on the desktop. Once I had that solved, I opened up MATLAB and was able to continue toying around with some basic functions. I got comfortable with adding, subtracting, multiplying, dividing, etc. It is not too bad to catch onto the way MATLAB thinks after having experience with similar dealings in Java. I then dove into the Arrays and Matrices tutorial that I had skimmed over last week. I played around with creating some arrays and matrices. I tried some operations on them. One interesting difference was the .* operator vs. the * operator. The idea of pairing up elements rather than using standard matrix multiplication was a nice addition to the abilities of MATLAB. The picture below shows the difference between multiplying a matrix by itself using normal matrix multiplication (*) and multiplying a matrix by itself by pairing up the values that share coordinates (.*). I got myself familiar with the short and long formats of numbers, differing from Java's denotation of int (integer) and double (decimals). I was curious about the variable storage system, and discovered that it is largely similar to Java. Below is a screenshot of when I tested whether performing an operation on "a" would change "a" itself, and discovered that, as in Java, in order to perform an operation on "a" and save the change to "a", I needed to set a=the operation. It is very interesting to see the parallels and the slight differences between Java and MATLAB. In java, in order to show the value of a variable, the command "return" was used. In MATLAB, in order to see the variable's value, one must type the variable name and hit the "return" key. Also, the variable-setting system is essentially the same. Finally, the matrix writing is almost the same. In Java, a matrix is declared with. This leaves the door open for multiple dimensions in Java matrices, as a matrix in Java is merely an array inside an array. MATLAB has a similar declaration method, but I do not see the functionality for added dimensions in MATLAB matrices. I left QuarkNet today at 6:00

November 14th
Today I arrived at QuarkNet at 4:15. I first revisited the "Desktop Basics" tab of the "Getting Started with MATLAB" help menu to see if I had missed anything during my quick skim of it last week. It turns out I did. I did not notice the way that MATLAB decides whether to display an output. The use of a semicolon causes it to not display the answer. So, a piece of code like the one below lets a fairly complex series of calculations be compressed into a much smaller space. If I had omitted all the semicolons, this calculation would have taken up an obnoxious amount of space. Considering all I wanted to know was the final answer (the sum of the products of the three possible pairs of a, b, and c), there was no point in displaying all the stored values in the various steps of the calculation. Then I proceeded on to the next new section of the "Getting Started with MATLAB" menu: Array Indexing. I am very familiar with Java arrays, so the concept of array indexing wasn't anything new. MATLAB has two forms of referral: coordinates in the array (an ordered pair of (row, column)), or a single number index that counts down each column starting from the left column. Below is my little test to make sure I had this system down. I succeeded with both index methods in attempting to locate the "3" in the array matrix I created. The next interesting thing I learned about arrays in MATLAB is that, while it generates an error to attempt to refer to an element that is out of the bounds of the array, you can declare an element that is outside of the bounds of the array and MATLAB will force the bounds to change so that element will become part of the array. An example of each of these situations is in the picture below. The first time, I tried to set b equal to the element at (4,4) in a, but since it doesn't exist I was given an error. The second time, I set the location (4,4) that did not exist at the time equal to 10 and MATLAB changed the dimensions of a to fit 10 at (4,4). The next thing I learned is something unique to MATLAB - the colon operator. In Java, colons are used in very rare situations such as the "for each" loop. In MATLAB, on the other hand, a colon is a way to select or create a group of values. If I have a one-dimensional array called "x" that consists of the numbers 1, 2, and 3, I can have MATLAB return all three of them by typing this command: x(1:3). This can be taken a step further by indexing, say, multiple values in a two dimensional array. If I want MATLAB to tell me what the values in row 2-3, columns 6-8 of array "q" are, I merely need to type q(2:3,6:8). Additionally, the colon operator can be used on its own (without numbers) to grab an entire group of values. For example, if I want all of row 3 of array "y", I merely type y(3,:). One final function of the colon operator is in the creation of a set of evenly spaced values. Below are a couple of examples. In the first example, I created an array of the numbers from 1-10. The default of the colon function's value set creation is to count by 1's from the first number input to the second. The other version is to input a third number in the middle that specifies how much to count by. So, in the second example I created an array of the values from 0-100 counting by 10s. I feel as if this will be extremely useful in anything involving linear relationships, as it is a shortcut to a group of numbers in a function. In fact, my second example would be the y-values of y=10x for the x-values of 0-10. One last thing I was curious about was how this function deals with decimals and endpoints that aren't perfect. In the example below, I ask it to count by 0.5's from 1.2 to 3.9. It is clear that decimals are no dilemma, although it appears that there is a certain limit to the amount of decimal places to which MATLAB will calculate. It appears that the standard procedure is to use 4 decimal places. Below is shown an attempt to see how many decimal places the "long" number format holds. It appears that the "long" format maxes out at 15 decimal places. Today I left QuarkNet at 6:15.