Advertisement
hiddenGem

Potential Difference Among 3 Capacitors

Jun 9th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.97 KB | None | 0 0
  1. %% Potential Difference Among 3 Capacitors
  2. % Determining the potential difference from point A to B when there are two
  3. % two capacitors in parallel and another in series.
  4. % Notes and clarifications are at the bottom of code
  5.  
  6. C1 = input('The capacitance in C1\n');
  7. C2 = input('The capacitance in C2\n');
  8. C3 = input('The capacitance in C3\n');
  9. a = input('Are you given the potential difference across C1 or one of the capacitors in parallel?\n');
  10. switch a
  11.     case 1
  12.         V1 = input('The potential difference across C1\n');
  13.         V2 = C1*V1/(C2+C3);
  14.         V = V1 + V2;
  15.     case 2
  16.         V2 = input('The potential difference across C2 or C3\n');
  17.         V1 = (C2+C3)*V2/C1;
  18.         V = V1 + V2;
  19. end
  20. fprintf('The potential difference is %e V', V);
  21.  
  22. %{
  23. This code has a different layout then some of the other codes because there
  24.     are different ways to solve the equation depending on what is given
  25. This code works under the assumption that C2 and C3 are in parallel
  26. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement