Thursday, October 8, 2015

Blog Post #10 for 10/08

Exercise 1: Data Types and 'Class'

This was a simple exercise showing us how to create a 'single' array rather than double:


This is the workspace produced after running the program above. Notice matrix D is labeled as 'single'



Exercise 2: More Data Types and Class

This was a more in-depth understanding of data types and class, including the integer function and how matlab handles different types of data:


Output for the program (see comments above for explanation)

Workspace formed after running the program. Notice how E (which is double A + single B) is a single class matrix. This means that, by default, Matlab chooses the lowest bit count.



Exercise 3: Characters

In this exercise, we figured out how matlab interprets character strings. We were told to take the word 'matlab' and capitalize it knowing that, in the computer language, capital letters are 32 away form the lower-case letters.


Output for the program



Exercise 4: Logical Data

In this exercise, we learned that logical arrays output a series of 1's or 0's depending on which statements are true or false, respectively. We also learned about the sparse function, which will extract all non-zero information from a matrix and indicate where those data points are located.


Output for the program. P actually output 1000 data points, which is way too long to post on here so I only took the first 10. Notice that z is a 'logic' statement, so 1 means true and 0 means false.

Workspace generated from the program. Notice matrices 'M' and 'z' are of the 'logical' class, meaning they are simply displaying true/false statements.



Exercise 5: Multidimensional Arrays

This was a simple exercise showing how to create multidimensional arrays (Ex: 2x3x5 matrix)


Workspace generated by the program. Notice that 'my_3D_aray' is a 2x3x3 matrix.



Exercise 6: Cell Arrays

In this exercise, we learned how to work with cell arrays, which can be used to create matrices within matrices; allowing you to string together sets of data of different classes.


Workspace generated by the program. Notice matrix D is a 1x3 'cell', which means it contains various types of classes.





No comments:

Post a Comment