Engr/Math/Physics 25 Prob 6.18 Chem Rcn Rate Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engineering/Math/Physics 25: Computational Methods 1 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt More Linear TransForms These are NOT the Only Functional Relationships that can be Linearized: m mx pwr exp y bx y be ANY Function with exactly TWO fitting Parameters is a Candidate for Linearization • e.g.; recall the Clayeron Eqn Engineering/Math/Physics 25: Computational Methods 2 Pv ln P v ,ref m 1 b T Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt Problem 6.18 Chemical Rcn Order 1st Order Rate Eqn is Expontnential C t C 0 e kt y be mx • By SemiLog Linearization we can “Discover” parameters [m & b] [−k & C(0)] 1 1 2nd Order Eqn can kt be LINEARIZED as C t C 0 • Thus ANOTHER Linearizable Fcn 1 y mx 1 b Engineering/Math/Physics 25: Computational Methods 3 Y2 mX 2 B2 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt Prob Solve 1st Step → PLOT it Advice for Every Engineer and Applied Mathematician or Physicist: Rule-1: When in Doubt PLOT IT! Rule-2: If you don’t KNOW when to DOUBT, then PLOT EVERYTHING Engineering/Math/Physics 25: Computational Methods 4 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt The Concentration vs Time Data For NitrousOxide Decomposition 2 NO2 2 NO O2 3 Time, t (s) C (mol/L) C (mol/m ) 0 0.0100 10.0 50 0.0079 7.90 100 0.0065 6.50 200 0.0048 4.80 300 0.0038 3.80 Engineering/Math/Physics 25: Computational Methods 5 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt The Data Bar Charted Prob 6.18 Data 10 9 8 C (mol/m 3) 7 6 5 4 3 2 1 0 0 50 100 200 300 Time (s) Engineering/Math/Physics 25: Computational Methods 6 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt Prob 6.18 When in Doubt PLOT (use SubPlot) 1st Ord => ln(C) -4.6 Some CURVATURE -4.8 -5 -5.2 -5.4 -5.6 0 50 100 150 t 200 250 300 2nd Ord =>1/C 300 Straight 250 • Better Model • t X • 1/C Y 200 150 100 0 50 100 150 t Engineering/Math/Physics 25: Computational Methods 7 200 250 300 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt Linear Xform of 2nd Order Reaction Now that the plot has identified the Rcn as 2nd Order, Make Linear Xform The 2nd Order Eqn 1 1 kt C t C 0 Y2 mX 2 B2 Engineering/Math/Physics 25: Computational Methods 8 Use polyfit of order-1 to generate fitting parameters contained in vector k_1overC0 That is: k_1overC0 = [m, B2]; or • k_1overC0(1) =m→k • k_1overC0(2) = B2 → 1/C(0) Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt 9 The 2nd Order Model % Bruce Mayer, PE * 11Mar12 % ENGR25 % file = Prob6_18_Chem_Concentration_1203.m % % CLEAR out any previous runs clear % % The Data Vectors t = [0,50,100,200,300]; % time in Sec C = [0.01,0.0079,0.0065,0.0048,0.0038]; % Concen in mol/L % % WHEN IN DOUBT => PLOT %* in this plot vs t to reveal Rch Order: ln(C) & 1/C %** the Xformed DataVectors for RCN ORDER Cfirst = log(C); Csecond = 1./C; % % Check which one gives straight line subplot(2,1,1) plot(t,Cfirst,t,Cfirst,'*'), xlabel('t'), ylabel('1st Ord => ln(C)'), grid subplot(2,1,2) plot(t,Csecond,t,Csecond,'o'), xlabel('t'), ylabel('2nd Ord =>1/C'), grid % % After Comparing two curves, 2nd order gives much straighter line %* use PolyFit to fit to 1/C(t)= k*t + 1/C0 %* Xform to Line => 1/C => Y, t => X, k => m, 1/C0 =>b % Calc k & C0 showing in scientific notation format short e k_1overC0 = polyfit(t,Csecond,1) k = k_1overC0(1) C0 = 1/k_1overC0(2) % % Calc Cfit using 300 pts for smooth curve tFit = linspace(0,300,300); Cfit = 1./(k*tFit +1/C0); % disp('CLOSE Figure window, then hit any key to Continue') pause % % Plot Data and fit. Put date in mol/cubic-meter plot(t, 1000*C, 'd', tFit, 1000*Cfit, 'LineWidth', 2),xlabel('t (s)'),... ylabel('C (mol/m^3)'), grid, legend('Data', 'Curve Fit') Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt P 6.18 Answer k_1overC0 = [m B2] = [k 1/C0] = [5.4445e-001 9.9605e+001] k = 5.4445e-001 • k = 0.54445/(L/mol∙sec) C0 = 1/9.9605e+001 1.0040e-002 2 NO2 2 NO O2 1 1 kt C t C0 • C(0) = 0.01004 mol/Liter Engineering/Math/Physics 25: Computational Methods 10 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt Compare Data to Fit 11 Data Curve Fit 10 9 C (mol/m3) 8 7 6 5 4 3 0 50 100 150 200 250 t (s) Engineering/Math/Physics 25: Computational Methods 11 Bruce Mayer, PE BMayer@ChabotCollege.edu • ENGR-25_Programming-1.ppt 300