Ise212engineering Computing:MATLAB Spring 2013

Ise212engineering Computing:MATLAB Spring 2013

ISE212Engineering Computing:MATLAB Spring_2013

Homework #3 Due:Friday3/15/2013

Upload your HW3 assignments to the TA by going to Content in Blackboard:

style1.In many engineering applications, it is necessary to have the surface of the metal components hard enough to resist wear and erosion, while having the core ductile and tough in order to withstand impact and shock loading. A common surface hardening process is called carburizing. Carburizing involves the diffusion of carbon into the surface layer of a steel component that has low-carbon content (less than 0.4%). This is achieved in industry by placing the component in a carbon-rich medium at elevated temperature. The diffusivity (in cm2/s) is a measure of how fast diffusion occurs, and can be modeled as:

D = D0e(–Q/ RT)

where:

D0 = diffusion coefficient

Q = activation energy, j/mole

R = ideal gas constant, 8.314 J/mole K

T = temperature, K

As iron is heated, it changes micro-structure, and its diffusion characteristics change. The values of D0and Q are shown in the table for carbon diffusing through each of iron’s structures:

Metal Type D0 (cm2/s)Q (J/mole K)

Alpha Fe (Body-Centered Cubic) 0.100 99,000

Gamma Fe (Face-Centered Cubic) 0.200 130,000

Write an executable script file (m-file) that takes no input and returns a plot of diffusivity (y) versus inverse temperature (1/T) for Alpha Fe (BCC) and Gamma Fe (FCC)using the data provided. Provide a rectangular, semi-log (2), and log-log plot to see which represent the results best and allows a user to read values from the graph easily over a wide range of both temperatures and diffusivities. Let the temperature vary from room temperature:10OC to 1100 OC. Place all four plot variations on the same figure. Place x-labels only on the two bottom graphs to reduce clutter and add a legend only to the first plot. Your plot must assume the following qualities:

(Name your m-file>carburizing.m).

grid on

plot Δ x = 2.0

Title:Diffusivity

x-axis label:Inverse Temperature, K-1 x 10-3

y-axis label: Diffusivitycm2/s

Alpha Fe curves should be in blue solid lines, Gamma Fe curves in green dashed lines.

(Make sure to use the correct units for temperature in your equation).

2.Suppose the following matrix represents the number of robots ordered from your company each month over the last year.

Robots = [2, 4, 5, 13, 7, 15, 20, 22, 24, 18, 18, 15]

All the numbers should be zero or positive.

(a) Use an if statement to check whether any of the values in the matrix are invalid. (Evaluate the whole matrix at once in a single if statement.) Send either the message “All valid” or “Invalid number found” to the screen, depending on the results of your analysis.

(b) Change the robots matrix to include at least one negative number, and check your program to make sure that it works for both cases.

Write an executable script file (m-file) that will execute the program described above.

(Name your m-file: robots.m).

G ClassFiles ISE212ClassNotes HomeworkAnswers Robot3 jpgAns=

3.Write an executable script file (m-file) that prompts the user to enter the temperature outside in degrees Fahrenheit. If the temperature entered is 70°F or higher, send a message to the command window telling the user to wear shorts. If the temperature entered is between 60°F and 70°F, send a message to the command window telling the user that it is a beautiful day. If the temperature is equal to or below 60°F, but greater than 30°F, send a message to the command window telling the user to wear a jacket or coat. If the temperature is less than or equal to 30°F, send a message to the command window telling the user that he or she must be in Binghamton.
(Name your m-file>BeachDay.m).

Ans=

4.Howard and Todd are running a trip for the Snocats to go skiing and snowboardingatGreekPeak. Eachregular ticket costs$64. If the group gets20 or more students the tickets willcost $49 at the group rate. The group alsoneeds to rent a bus fromOCCT thatcosts$50 per hour. The group plans to leavefrom the Union at10:00AM and return at5:00PM. Write an executable script file that prompts the user to enter the number of studentsthat plan to attend and returns the total cost and the cost per studentsotheycanmake sure to collectenough money to cover the costs.

(Name your m-file > Snocats.m).

Ans=

THE END