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



Thursday, September 17, 2015

HW #6

PROBLEM #1: ROCKET HEIGHT VS. TIME





PROBLEM #2: SOLID ROCKET FUEL PASS/FAIL

Output for Problem # 2




PROBLEM #3: 401K RETIREMENT SAVINGS



Function for Problem #3:

   
 

HW #5

#1: ASTM GRAIN SIZE






#2: POLYGON


 This function will graph a polygon based on the number of sides the user inputs. Below is an example polar graph when the user inputs 5 for the number of sides.





PROBLEM #3: ENERGY VS MASS






PROBLEM #4: DISTANCE TO THE HORIZON





PROBLEM #5: DISTANCE, VELOCITY, AND ACCELERATION IN FREE FALL







Blog Post #8 for 09/17

FOR LOOP PRACTICE
 The program on top will determine how many numbers in matrix x are greater than thirty (basically the find tool), while the program on the bottom sums all of the values of matrix x (basically the sum tool).


WHILE LOOP PRACTICE
 This function also replicates the embedded 'find' function in matlab, but it uses a while loop rather than a for loop.


ALTERNATING HARMONIC SERIES
 This program will determine how many cumulative sums are required in order to calculate ln(2) within four digits of precision.


DIVERGING SERIES
 This program determines how many cumulative sums must be performed until the two values for 'total' are separated by at least 0.001. The program will stop if more than 50 sums are required.


FACTORIAL
This function will determine the factorial for a user inputted value, which is simply the MatLab embedded 'factorial' function.

Blog Post #7 for 09/15

PART LENGTH

This simple function allows the user to input a part length, and will determine whether or not that particular part meets the criteria. If not, the program will put you down.


NAVY HEIGHT REQUIREMENT

 This program will analyze the heights of Navy applicants and output a table of accepted and declined candidate based on the height inputs.


ROCKET TRAJECTORY

 This simple program allows the user to input a particular time and determine whether the rocket is in stage 1, stage 2, stage 3, or free fall.


HOSPITAL TEMPERATURES


This program will analyze a matrix of numbers representing the temperatures of patients (rows = patient number, columns = station number) and determine which patients have a fever. It will output which patient at which station, along with the temperature of that particular patient.

Output:



GAS PRICES

This program allows the user to input the unit of measurement they would like to use to fill their gas tank, as well as the amount of gasoline, and it will output the price to fill their car with that amount of gasoline assuming $3.89 per gallon.

Output:




LEGAL DRINKING AGE

This function allows the user to enter their age and determines whether or not they are old enough to drink alcohol.

Output: 

Blog Post #6 for 09/10

DIFFUSIVITY EXERCISE

This program uses a similar prompt as the one in the homework, except this one will calculate and plot the diffusivity of two different materials based on a set of temperatures.

Graphical output of the data from the program above. Alpha diffusivity is depicted in blue, while beta diffusivity is depicted in red.



TURN A HELIX INTO A TORNADO
In this exercise, we were given a program that graphs a helix horizontally along the x-axis. We were told to transform this helix into a vertically standing "tornado" shape. This was done by manipulating the three equations to have the data set run along the z-axis rather than the x-axis and adjusting some of the values within the equation






MESHGRID


In this exercise, we used the meshgrid function in order to combine two matrices into a single large matrix. We plotted this matrix using four different 3-D graphing tools embedded within MatLab.





HALL-PETCH EXERCISE