Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is MATLAB. Balance Chemical Equations 1 Write a function BalanceChemical to balance chemical reactions by solving a linear set of equations. The inputs arguments
This is MATLAB.
Balance Chemical Equations 1 Write a function BalanceChemical to balance chemical reactions by solving a linear set of equations. The inputs arguments are 1. Reagents: Symbols of reagents in string row array 2. Products: Symbols of products in string row array 3. Elements: Elements in the reaction in string row array 4. EICmpReag: Elemental composition of reactants in two dimensional numeric array 5. ElCmpPrdcts: Elemental composition of prducts in two dimensional numeric array Hint: The first part of the problem is setting up the set of linear equations that should be solve. The second part of the problem is to find the integers from the solution. One way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left and right-side integers exist. For example, for the reaction that involves CH4 reacting with 02 to produce CO2 and H20: Reagents-["CH4", "O2"]; ElCmpReag [1,4,0; Products =["c02", "H20"]; Elements -["C","H", "O"] 0,0,2; where the first row corresponds to elements in Reagents (1), 2nd to Reagents(2), etc. given in the order specified by Elements ELCmpPrdcts =[1,0,2; where the first row corresponds to Products (1), 2nd to Products (2), etc. given in the order specified by Elements. The outputs arguments are 1. leftsidelntegers: Left-side integers of reactants to balance the equation 2. rightsidelnteger: Right-side integers products to balance the equation 3. coefMat: The coefficient matrix that was composed to balance the equation For example, balance CH4+ O2 ? CO2+ H2O >>Reagents= ["CH4", "O2"]; Products -["c02", "H20"]; >>Elements =("C","H","0"];ELCmpReagz [1 ,4 , 0 ; 0,0,2); ELCmpPrdcts =[1,0,2;0,2,1]; >>[leftsideIntegers, rightsideIntegers, coefMat] = BalanceChemica (Reagents,Products,Elements,ELCmpReag , E leftside!ntegers 1x2 uint8 row vector rightsideIntegersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started