Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% CuSO4 Solution
- % Determines how much copper is deposited on the cell
- % Notes and clarifications are at the bottom of the code
- % Constants
- massCu = 63.5; % [g/mol] The atomic mass of copper
- eCharge = 1.6*10^-19; % [C] The charge of an electron
- Na = 6.02*10^23; % [1/mol] Avogadro's constant
- % Inputs and Variables
- I = input('The current running through the solution in Amps\n');
- deltat = input('The duration in hours\n') * 3600;
- % Outputs and Equations
- Q = I * deltat; % [C] The total charge
- NumOfE = Q/eCharge; % [electrons] The number of electrons
- NumOfCu = NumOfE/2; % [Cu atoms] The number of Copper atoms
- n = NumOfCu/Na; % [mol] The number of Cu Moles
- depoMass = n * massCu; % [g] Deposited Copper mass
- fprintf('The copper deposited is %e g', depoMass);
- %{
- There are a lot more notes than usual so please take the time to read
- Under the assumption that an electric current runs thorugh an electrolytic
- cell containing copper-sulfate solution.
- Notice that for this code the user input for time is in hours. However, the
- variable deltat is in seconds. To change this edit line 12.
- The atomic mass of copper is not technically a constant but it is the
- average mass of copper and will be used as a constant for this code.
- The reason the number of electrons is divided by 2 in line 17 to equal the
- number of Cu atoms is because 2 electrons are required to neutralize a
- Cu2+ ion
- The units for Avogadro's number is usually mol. However in this code the
- degree power is 23 not -23, so the units are 1/mol.
- This code can be changed for any electrolytic solution by changing the
- atomic mass in line 6, the number of electrons needed to neutralize the
- ion in line 17, and the name of variables and fprintf line.
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement