Monday, October 5, 2015

MATLAB Homework 3


Problem 1


   For the first problem, we had to create a distance calculator using the coordinate system. The calculator has the user input coordinates on Earth and these coordinates are stored into variables for calculations. This calculator only calculates distance on the norther hemisphere of the Earth. When the user inputs the coordinate of two places, the programs displays what calculations took place. What happens in the program is that the coordinates inputted are converted to spherical coordinates. Once we have the spherical coordinates, we convert these spherical coordinates to rectangular. With these rectangular coordinates, we can do some vector calculations involving the definition of the dot product. The dot product allows us to find the gamma between the two vectors. Once we have the gamma, we can, then, find the distance between the two places using the definition of the arc length, which is the angle in radians times the length of the radius.


   The picture above shows the results of the program for distance calculations

Problem 2

 
   To begin the second problem, we begin by inserting a matrix into MATLAB. We can do this just by using the import command. We can also create a dimensionless matrix in the workspace and make changes to the matrix by copying and pasting the matrix data from excel.


   Using the matrix created, we had to find the maximum values of each column, the minimum values of each column, and the maximum values of the entire matrix. The columns represent the thermocouple temperatures. This problem was done by creating separate arrays from the given matrix and labeling these arrays by the column they represent. One the arrays are created, I am, then, able to mind max values using the max command and minimum values using the min command. To find the max value of the entire matrix, I simply find the max of the entire matrix first. This would give me an array of maximum values. I, then, use the max function, again, to find the max value of the max values. So, I use the max function within the max function.


  The results of the program are displayed in the picture above. The max values of each column are represented by x variables and the the minimum values are represented by y variables. The largest variable shows the largest number of the entire matrix.

Problem 3


   For this problem, we had to create an array whose average was 80 and whose standard deviation was 23.5. We obtain the average by adding 80 to the matrix of random numbers. We obtain the standard deviation of 23.5 by multiplying the array by 23.5.

Problem 4


   We take a look at a circuit problem. The problem has some givens and equations. We simply state the givens and calculate using the equations and the givens. This problem emphasizes imaginary numbers, which are seen in circuit analysis.

Problem 5




   The last problem had us calculate the precipitation of a time period from January 1, 2015 to September 3, 2015. The obtained from the website was a simple 241 by 2. Like the first problem, I broke down the tables columns into arrays. Then, I summed the values for precipitation and found a value in decimeters. We also had to use the first program to compare different stations according to their coordinates and choose the station closest to home. 

No comments:

Post a Comment