Thursday, October 8, 2015

HW #10

Problem #1: Solving Systems of Linear Equations

In this problem, we were given a system of linear equations and were instructed to input these equations into a matrix, then solve for the system using the inv() function as well as the back-divide (\) notation. Using the tic/toc feature, we can determine which method is the most time-efficient.




This is the output for the program depicted above:



Problem #2: Chemical Processing

In this problem, we were given a representation of a separation process in which a stream of water, ethanol and methanol flow into a processor and two streams flow out. Some of the variables were missing from the picture, and we were told to solve for the missing variables.


Output for the program:



Problem 3: Statics Problem

For this problem, we were given a static situation in which a force is applied at an angle to the top of a triangular system with a hinge on one side and a roller on the other. We were instructed to solve for the forces on each side of the triangle, as well as the reactive forces at the two bottom points of the triangle.


Output for the program:



HW #9

Problem #1: Composition of Air

The percent compositions and molecular weight of certain elements in air were given in a table. We were instructed to create a matrix of the data and use the dot() function to find the molecular weight of air.


Output for the program:




Problem #2: Bomb Calorimeter

The masses and heat capacities for 4 different materials were given in a table consisting of four calorimeter experiments. We were told to calculate the total heat capacity for the calorimeter in each experiment using matrix multiplication.





Problem #3: Determinant

In this problem, we were given three sets of matrices and instructed to determine whether or not each matrix is invertable. This is done by taking the determinant of each matrix. If the determinant is 0, the matrix is invertable; otherwise, there is no inverse for that matrix.


Output and results for the program are shown below.



Problem #4: Cross Product

In this problem, we were instructed to calculate the moment at two different points on a shelf with a mass hanging off of the corner. This was accomplished by setting up matrices for the direction and force vectors and taking a cross product.


Output for the program


Hw #8

Problem #1: Free fall distance for each planet in the solar system

Given the value of acceleration due to gravity on each planet, we used simple kinematics to determine the free fall distance on each planet over a time from 0 to 100s




Shown below is a graphical interpretation of the free fall distance vs. time data obtained from the Matlab program. The program also outputs a table that is way too big to blog.



Problem #2: 

This was simply a practice of how to manipulate matrices and work with them in Matlab.


Shown below are the results of the matrix manipulations





Problem #3: Magic Matrices

In this problem, we created a magic 5x5 matrix, matrix A, and performed various manipulations on it: 2A, A^2, and A+2. We were then instructed to test each resulting matrix to determine whether or not it is still a magic matrix.

This function was used to test each matrix


This program creates the magic matrix and performs the manipulations. It then calls the 'IsMagic' function in order to determine whether or not the resulting matrix is still magic.



Output from the program.

Blog Post #9 for 10/01

Exercise 1: Dot Product

The image shown below is a simple practice for the dot product function in Matlab. The Price is the price of the food alone; the total price includes tax.






Exercise 2: Finding the angle between two force vectors

The problem statement and solution written on a white board in class is shown below. 



Code used in Matlab in order to solve the problem shown above.


The results are shown below, with the angle in radians as well as degrees.




Exercise 3: Finding the center of mass

In this exercise, we were given a set of components floating around in free space and we were instructed to find the center of mass of the system using Matlab. Shown below is the whiteboard problem statement and hand-written solution.


The image below is the code used in order to solve for the center of mass using Matlab.



Below is the graphical output of the center of mass problem.





Exercise 4: Inverse practice

In this exercise, we were instructed to create three matrices and find the inverse for each one using the inv() function as well as using ^-1 in order to show that both methods yield the same results.


These are the outputs from the exercise: 

Inverse of matrix A


Inverse of matrix B

 Inverse of matrix C



Exercise 5: Moment

In this exercise, we were given two points on an object and a force acting on it and we were instructed to find the moment about each point. We were also instructed to create a user input program that allows the user to enter a force and direction vector to find the moment. Shown below is the problem statement and hand-written example on the white board.


Below is the code used for solving this particular moment problem:


Shown below is the output generated from Matlab. Moment represents themoment about that particular point. iMoment represents the moment based on the user input for force vector and direction vector.







Tuesday, October 6, 2015

HW #7

Problem #1
Part A: Create a program that allows the user to input the first two digits of a Fibonacci sequence and the number of elements desired. The program should output a graph in polar coordinates of the sequence desired by the user.


Pictured below is a graph of the result from entering 1 and 2 as the first two digits for the first 6 elements of the Fibonacci sequence.



Part B: Create a program that allows the user to enter the first two elements of a Fibonacci sequence that will determine the number of terms required to reach the "golden ratio".





Problem 2: Create a square root function using loops


This is a function created using Halley's method for approximating the square root.

Using the function above, a program was written to allow the user to input the number they wish to square root, as well as their best guess. Both points of information are used to approximate the square root.


Blog Post #8 for 09/29

Exercise 1: Find the distance to the horizon on Earth and on the Moon for hills of varying heights


The code above will output the following table:




Exercise 2: Find the max temp and corresponding times for three thermocouples