Tuesday, December 15, 2015

Day 6 (HW 5)


#1


#2





#3





#4




ans = 

    heights    distance_earth    distance_mars
    _______    ______________    _____________

        0           0                 0       
      100        1263             923.8       
      200      1791.8            1314.1       
      300      2201.3            1618.7       
      400      2549.7            1879.8       
      500      2859.4            2113.5       
      600      3141.8            2328.2       
      700      3403.9            2528.6       
      800      3649.9            2717.9       
      900      3882.9            2898.4       
     1000      4105.1            3071.5       
     1100      4318.2            3238.4       
     1200      4523.5            3400.1       
     1300        4722            3557.3       
     1400      4914.5            3710.5       
     1500      5101.8            3860.2       
     1600      5284.2            4006.8       
     1700      5462.5            4150.6       
     1800      5636.8              4292       
     1900      5807.7            4431.1       
     2000      5975.3            4568.2       
     2100        6140            4703.3       
     2200      6301.9            4836.8       
     2300      6461.4            4968.7       
     2400      6618.5            5099.2       
     2500      6773.5            5228.3       
     2600      6926.4            5356.2       
     2700      7077.5            5482.9       
     2800      7226.7            5608.5       
     2900      7374.3            5733.1       
     3000      7520.4            5856.8       
     3100      7664.9            5979.6       
     3200      7808.1            6101.5       
     3300      7949.9            6222.7       
     3400      8090.5            6343.2       
     3500      8229.9            6462.9       
     3600      8368.2              6582       
     3700      8505.4            6700.4       
     3800      8641.6            6818.3       
     3900      8776.8            6935.6       
     4000      8911.1            7052.4       
     4100      9044.5            7168.6       
     4200      9177.1            7284.4       
     4300      9308.8            7399.7       
     4400      9439.7            7514.6       
     4500        9570            7629.1       
     4600      9699.4            7743.2       
     4700      9828.2            7856.8       
     4800      9956.4            7970.1       
     4900       10084            8083.1       
     5000       10211            8195.7       
     5100       10337              8308       
     5200       10463              8420       
     5300       10588            8531.7       
     5400       10713            8643.1       
     5500       10837            8754.3       
     5600       10960            8865.1       
     5700       11084            8975.7       
     5800       11206            9086.1       
     5900       11329            9196.2       
     6000       11450            9306.1       
     6100       11572            9415.8       
     6200       11693            9525.3       
     6300       11813            9634.5       
     6400       11934            9743.6       
     6500       12054            9852.5       
     6600       12173            9961.1       
     6700       12292             10070       
     6800       12411             10178       
     6900       12530             10286       
     7000       12648             10394       
     7100       12766             10502       
     7200       12883             10610       
     7300       13000             10717       
     7400       13117             10825       
     7500       13234             10932       
     7600       13350             11039       
     7700       13467             11146       
     7800       13583             11253       
     7900       13698             11360       
     8000       13814             11466       
     8100       13929             11573       
     8200       14044             11679       
     8300       14158             11785       
     8400       14273             11891       
     8500       14387             11997       
     8600       14501             12103       
     8700       14615             12209       
     8800       14729             12315       
     8900       14842             12421       
     9000       14956             12526       
     9100       15069             12632       
     9200       15182             12737       
     9300       15294             12842       
     9400       15407             12948       
     9500       15519             13053       
     9600       15631             13158       
     9700       15743             13263       
     9800       15855             13368       
     9900       15967             13472       
    10000       16079             13577       




#5


x =

   1.0e+03 *

  Columns 1 through 12

         0   -0.0012   -0.0049   -0.0110   -0.0196   -0.0307   -0.0441   -0.0601   -0.0785   -0.0993   -0.1226   -0.1484

  Columns 13 through 24

   -0.1766   -0.2072   -0.2403   -0.2759   -0.3139   -0.3544   -0.3973   -0.4427   -0.4905   -0.5408   -0.5935   -0.6487

  Columns 25 through 36

   -0.7063   -0.7664   -0.8289   -0.8939   -0.9614   -1.0313   -1.1036   -1.1784   -1.2557   -1.3354   -1.4175   -1.5022

  Columns 37 through 41

   -1.5892   -1.6787   -1.7707   -1.8651   -1.9620


v =

  Columns 1 through 12

         0   -4.9050   -9.8100  -14.7150  -19.6200  -24.5250  -29.4300  -34.3350  -39.2400  -44.1450  -49.0500  -53.9550

  Columns 13 through 24

  -58.8600  -63.7650  -68.6700  -73.5750  -78.4800  -83.3850  -88.2900  -93.1950  -98.1000 -103.0050 -107.9100 -112.8150

  Columns 25 through 36

 -117.7200 -122.6250 -127.5300 -132.4350 -137.3400 -142.2450 -147.1500 -152.0550 -156.9600 -161.8650 -166.7700 -171.6750

  Columns 37 through 41

 -176.5800 -181.4850 -186.3900 -191.2950 -196.2000


a =

  Columns 1 through 12

   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100

  Columns 13 through 24

   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100

  Columns 25 through 36

   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100

  Columns 37 through 41

   -9.8100   -9.8100   -9.8100   -9.8100   -9.8100


day 13 (lecture 13)

#1 first time using symbolic equations

#2 ezcontour

#3


#4 projectile motion cannon problem

*solve function solves for zeros automatically.
*THmax stands for theta max. OR the angle at which the cannon ball goes the farthest with the same initial velocity.
#4 Solving differentials symbolically




day 12 (lecture 12)

#1 this code doesn't do much

#2 This code changes the class type without changing the value


The second picture is the workspace

The rest of class we learned about cell arrays and structures which are like meta classes that allow someone to put different classes into a matrix. Like an array of matricies.

day 11(lecture 11)

#1 Kirchoffs loop rule
#2 another systems of equations problem but using the row echelon form

#3 water pump problem


day 10 (lecture 10)

#1 IN N OUT Burger Menu Cost
#2 find angle between vectors

#3 center of mass
*last column in Tot matrix should be the masses of all components

#4 a demonstration that inverse of matrix A x A is the identity matrix. And that they can be multiplied in any order

#5 My first Cross Product in Matlab :)

#6 Moment vector from force and distance vectors


Monday, December 14, 2015

day 9 (lecture)

This lecture had only two unique exercises. The repeated ones can be found in other posts


#1
a = [12 17 3 6] 
b = [5, 8, 3 1, 2, 3 2, 4, 6] 
c = [22 17 4] 


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. 
5) Assign to variable x5 the values in matrix c as the first column, the values in matrix b as columns        two through 4, and the values in matrix as the final column 
6) Convert matrix b to a column vector name x6 



#2

1) Create a 3 X 3 matrix of zeros
2) Create a 5 X 3 matrix of ones
3) Create a 4 X 6 matrix in which all the elements have a value of pi.
4) Use the diag function to create a matrix whose diagonal has value of 1, 2, 3.
5) Create a 10 X 10 magic matrix.
    a. Extract the diagonal from this matrix.
    b. Extract the diagonal that runs from lower left to upper right from this matrix.
    c. Confirm that the sums of the rows, columns, and diagonals are all the same.
6) Extract a 3 X 3 matrix from the upper left hand corner of the 10 X 10 matrix you just created. Is this also a magic matrix?




*Everything that has "ans" are all the sums of the magic square, the answer to the last question is no

day8 (lecture8) (HW 7)

We were learning for loops that day. This was a relatively short lecture and since this material was lost and since the HW was basically the same thing we did in class, I will only post the HW for this lesson.


#1



#2



#3




*ignore golden variable output for section 3

The first ans is the approximation and the second is the actual