Oct 1, 2015

Lecture 9

Today, we switched professors from Professor Mason to Professor Mahmoud.
I think we're going to go over simple data structures.

We started with the different ways of defining matrices.

1) Assign to the variable x1 the value in the second column of matrix a.
2) Assign to the variable x2 the third column of matrix b. 3) Assign to the variable x3 the values in matrix b along the diagonal.
4) Assign to variable x4 the first three value in matrix a as the first row and all the values in matrix b as the second through fourth row.

This shows that we can use the matrix(row number, column number) format to find a specific value in a specific row and column. You can also use a colon ':' to indicate any row and/or column.



This exercise lets us practice manipulating matrices. This program finds the maximum and minimum temperatures for each thermocouple. Then it creates a table showing the maximum/minimum temperatures with corresponding times.


In this practice exercise, we used meshgrid to find the areas of rectangles with lengths 1, 3, 5 and widths 2, 4, 6, 8.






This exercise lets us multiply all of the elements in one vector by all elements in another vector by using meshgrid(). More details in the comments.

Practice exercises