Friday 19 February 2010

Quantity versus Quality, Round 1 (FIGHT!)

You'd normally accomplish a lot more in a day than ten minutes, but apparently circumstances make the difference. Yesterday, I accomplished almost nothing. Today, leaps and bounds.

MATLAB still isn't done. I keep getting side-tracked by features that are nice but not necessary. I just finished putting in code to make all of my numbers print in reasonable ways rather than some ridiculous thing like "24.50000" or similar. That said, it is due tomorrow, and all I've got left to do is the relatively easy graphing part of it.

Ten minutes into my work today I tested something I hadn't before: I inspected the full contents of each of my vectors. Turns out they weren't vectors, but rather matrices. This creates a problem as the program couldn't just leave out a whole bunch of values, even if those values were zeros.

Brief walkthrough for those like me. A for loop like the one I posted yesterday will (when made correctly) add a new value to the variable on each pass. MATLAB warns you in advance that this could go slowly, unless you tell it beforehand how long the vector will wind up being. I went ahead and did that by putting in the zeros() function, which fills the vector (or matrix) in with zeros.

I was new to this though and put zeros(length(h)) in for each of these 'vectors.' This actually creates a square matrix, length(h) x length(h) in size. An easy fix, once the error of my ways was realized. By making it zeros(1,length(h)) I told MATLAB to make it 'matrix' with only one value in the vertical direction, or, more commonly, a vector. Then what I originally wanted to do for my table output worked fine, and my table was done.

Quality 1, Quantity 0

In other news, I picked up two new books today at the library. One is about developing games in Java. I keep claiming that's not my overall goal, but it does interest me and the book seems thorough, so I snagged it. The other is about Object-Oriented Programming with Java. While I consider myself pretty good with Java, I've yet to come to terms with what specifically I gain through the OOP aspect of the language. I think my MATLAB work has aided me with it a little, since the two are so close to each other, but hopefully this will help me take advantage of the feature more thoroughly.

On the cover of the latter book is a platypus (complete with fur, duck bill, and eggs) holding a balloon. My girlfriend has named him "Platty Pat" the platypus, and wanted me to share the fact. So, there, fact shared. Oh, and the little guy is holding the book, so a nice case of recursive art.

No comments: