140 likes | 229 Vues
Create a function-based program to calculate diffusivity of carbon in iron based on temperature in degrees Celsius, including plotting diffusivity against temperature in Kelvin.
E N D
Week 10- Project week 1 - Diffusion • Today: • Project forms • Assignment • Examples • Second Test
Meetings and Project Progress Forms • Teams must met with me in Kirk 212 every Tuesday and Thursday with project form completed. These forms are available on the web site for section7 • www.egr.uri.edu/che/course/egr106
First Assignment of Project EGR106 Section 7 Due April 8, 2008 – after class Instructions – The first problem in this assignment asks the team to write and test a program using a function. Name your file diffusion.m and submit it along with the answer to question 2 to m_cedrone@cox.net. 1. Using the following information, create a program using a function that will output the diffusivity of carbon – D - in iron from an input that is the temperature in degrees centigrade. D=Doe(-Q/RT) where Do = 2.2x10-4 m2/sec, Q=29300 cal/mole, R=1.987 cal/mole.K, T temp in oK ( ie K= 273+C) 2. Plot out the diffusivity in units of m2/sec against temperature in units of 1000/K (degrees Kelvin) from 300C to 1200C. Hint - take logs of the equation above. Put your team name as the title of the figure. These programs will be discussed at the meetings on Thursday April 10th.
Assignment 9 – Question 1: • Example of function diffusionC to calculate diffusivity at any temperature for carbon in BCC iron. • >> diffusionC(773) Note – input is temperature in oKelvin • ans = • 1.1423e-012 • >> diffusionC(1273) • ans = • 2.0500e-009 • >>
Future Programs. Input:- Temperature in oC, depth for desired carbon concentration, desired carbon concentration, average carbon concentration in steel and surface carbon concentration. Program:- Calculates the time required to meet input conditions. Output:- To reach 0.06 wt% Carbon concentration at0.0005 takes56hours at500 C
Future Programs. Diffusion profiles for carbon at 500oC after 50,500,5000 and 50000 secs
Second Test Question 1 >> A=[1,2,3];B=[4,5,6]; >> C=A.*B - command line needed C = 4 10 18
Second Test C = 2.3355 1.6184 -0.8421 >> A*C - check answer ans = 7.0000 5.0000 1.0000 Question 2 >> A=[2,3,3;4,2,9;6,-7,2];B=[7;5;1]; >> det(A) ans = 152 >> C=A\B
Second Test Question 3 function z=arearect(x,y) % Finds the area of a rectangle % Inputs are x and y for width and length % Simple demo z=x*y Question 4 >> arearect(4,5) z = 20 ans = 20
Second Test Question 5 >> A=[2,4,;8,10;12,14];B=[2,4,6;8,10,12];; >> C=A*B C = 36 48 60 96 132 168 136 188 240 YES Question 6 >> D=B*B ??? Error using ==> mtimes Inner matrix dimensions must agree. NO
Second Test Question 7. >> A=[2,4;4,8];B=[1,2;3,4]; >> C=A*B C = 14 20 28 40 2x1+ 3x4=14 2x2+4x4=20 4X1+3x8=28 4x2+8X4=40
Second Test Question 8 solution x=linspace(0,180,181); y=sind(x); z=cosd(x); w=tand(x); subplot(2,2,1); plot(x,y); subplot(2,2,2); plot(x,z); subplot(2,2,4); plot(x,w);
Second Test Question 9. Would the following commands run and if not can you correct them? xv = –2:0.1,2; yv = xv.^4 – 3*xv.^2 + 1; need period for element by element plot(x,y – need correct data and parenthesis (xv,yv) end