hiddenGem

Capacitance From a Voltage vs. Time Graph

Jun 21st, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.87 KB | None | 0 0
  1. %% Capacitance From a Voltage vs. Time Graph
  2. % Calculates capacitance by using a voltage. vs time graph.
  3. % Notes and clarifications are at the bottom of the code
  4.  
  5. % Inputs and Variables
  6. V0 = input('What is the voltage of the battery?\n');
  7. R = input('What is the resistance in ohms?\n');
  8. disp('These next inputs require a (V,t) coordinate pair from the curve')
  9. t = input('What is the value of t at the intersection?\n');
  10. V = input('What is the value of V at the intersection?\n');
  11.  
  12. % Outputs and Equations
  13. C = t/(R*log(V0/(V0-V)))
  14. fprintf('The capacitance is %.4e F', C);
  15.  
  16. %{
  17. V and t are found by using the graph and seeing where the the curve passes
  18.     through an intersection point. V is the y-coordinate and t is the
  19.     x-coordinate
  20. The output is rounded to 4 places after the decimal point. To change or remove
  21.     this feature, edit the .# in the fprintf line
  22. %}
Add Comment
Please, Sign In to add comment