1. Meteorologist in Northern States give both the outside temperature and the windchill factor. The factor is dependent upon the air temperature and wind velocity as shown by the table below.

Wind Speed

Temp (F) 5 10 15 20 25 30

-20 -26.0 -46.0 -58.0 -67.0 -75.0 -79.0

-15 -20.6 -39.9 -51.3 -59.9 -67.4 -71.3

-10 -15.1 -33.7 -44.6 -52.7 -59.9 -63.6

-5 -9.7 -27.6 -37.9 -45.6 -52.3 -55.9

0 -4.3 -21.4 -31.1 -38.4 -44.7 -48.1

5 1.1 -15.3 -24.4 -31.3 -37.1 -40.4

10 6.6 -9.1 -17.7 -24.1 -29.6 -32.7

15 12.0 -3.0 -11.0 -17.0 -22.0 -25.0

a.) Plot the windchill factor as a function of temperature for wind speeds of 5, 15, and 30 mph on the same graph. Include a legend.

b.) Ask the program user to input a temperature and velocity and output the value of the windchill factor. From the results of part (a), it can be seen that a linear interpolation using interp2 of the data will be sufficient. If the input is outside the allowable range, print an error message. Prompt the user to continue or exit the program. Submit your solutions for the following data sets:

Temp °F Wind Speed (mph)

Set 1 12 12

Set 2 -17 28

Set 3 -25 -10

2. The following data represents a subset of ENGR 112 students and their current grade in the course.

Alex Brad Charles Dirk Edward Fred Greg Hugo

91.2 68.6 87.2 99.5 80.5 77.3 81.1 52.3

Write a program that will “bubble sort” the data in descending and print the data in the form below. The basic step to the bubble sort algorithm is a single pass through the array of n elements, comparing adjacent elements. If a pair of adjacent elements is in the correct order (that is, the first value is greater than or equal to the second value), proceed to the next pair. If the pair is out of order, switch the values and then move to the next pair. It can take several passes to sort an array with this technique. If no switches are made in a single pass through the data then the data is already in descending order.

Name Grade

Dirk 99.5

Alex 91.2

Charles 87.2

… …

Hugo 52.3

3. The equations that characterize the surface separation distance between two points on a sphere were given in HW #1. Given the following data for latitude and longitude in decimal degrees:

City Latitude (degrees) Longitude (degrees)

Corvallis 44.56 N 123.27 W

Louisville 38.25 N 86.75 W

Munich 48.13 N 11.56 E

Reykjavik 64.13 N 21.93 W

St. Louis 38.61 N 90.18 W

Sydney 33.85 S 151.2 E

Write a complete MatLab program that does the following:

a.) Print the data as shown. The direction N/S or E/W should be stored as a character variable and used to calculate the polar and azimuth angles and , respectively.

b.) Find the largest surface separation distance in miles and print the result to 2 decimal places. Also print the corresponding names of the two cities.

Wind Speed

Temp (F) 5 10 15 20 25 30

-20 -26.0 -46.0 -58.0 -67.0 -75.0 -79.0

-15 -20.6 -39.9 -51.3 -59.9 -67.4 -71.3

-10 -15.1 -33.7 -44.6 -52.7 -59.9 -63.6

-5 -9.7 -27.6 -37.9 -45.6 -52.3 -55.9

0 -4.3 -21.4 -31.1 -38.4 -44.7 -48.1

5 1.1 -15.3 -24.4 -31.3 -37.1 -40.4

10 6.6 -9.1 -17.7 -24.1 -29.6 -32.7

15 12.0 -3.0 -11.0 -17.0 -22.0 -25.0

a.) Plot the windchill factor as a function of temperature for wind speeds of 5, 15, and 30 mph on the same graph. Include a legend.

b.) Ask the program user to input a temperature and velocity and output the value of the windchill factor. From the results of part (a), it can be seen that a linear interpolation using interp2 of the data will be sufficient. If the input is outside the allowable range, print an error message. Prompt the user to continue or exit the program. Submit your solutions for the following data sets:

Temp °F Wind Speed (mph)

Set 1 12 12

Set 2 -17 28

Set 3 -25 -10

2. The following data represents a subset of ENGR 112 students and their current grade in the course.

Alex Brad Charles Dirk Edward Fred Greg Hugo

91.2 68.6 87.2 99.5 80.5 77.3 81.1 52.3

Write a program that will “bubble sort” the data in descending and print the data in the form below. The basic step to the bubble sort algorithm is a single pass through the array of n elements, comparing adjacent elements. If a pair of adjacent elements is in the correct order (that is, the first value is greater than or equal to the second value), proceed to the next pair. If the pair is out of order, switch the values and then move to the next pair. It can take several passes to sort an array with this technique. If no switches are made in a single pass through the data then the data is already in descending order.

Name Grade

Dirk 99.5

Alex 91.2

Charles 87.2

… …

Hugo 52.3

3. The equations that characterize the surface separation distance between two points on a sphere were given in HW #1. Given the following data for latitude and longitude in decimal degrees:

City Latitude (degrees) Longitude (degrees)

Corvallis 44.56 N 123.27 W

Louisville 38.25 N 86.75 W

Munich 48.13 N 11.56 E

Reykjavik 64.13 N 21.93 W

St. Louis 38.61 N 90.18 W

Sydney 33.85 S 151.2 E

Write a complete MatLab program that does the following:

a.) Print the data as shown. The direction N/S or E/W should be stored as a character variable and used to calculate the polar and azimuth angles and , respectively.

b.) Find the largest surface separation distance in miles and print the result to 2 decimal places. Also print the corresponding names of the two cities.

### Recently Asked Questions

- Suppose babies born after a gestation period of 32 to 35 weeks have a mean weight of 2900 grams and a standard deviation of 900 grams while babies born after a

- Is there a way for me to share a screen shot? The table formatting falls off with this question, so it is probably quite hard to follow. Thanks! Three

- Determine the molecular formula of a molecule having an empirical formula of NH2 and a molar mass of 32 g/mol.