Advertisement
hiddenGem

CuSO4 Solution

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