Advertisement
hiddenGem

Specific Loop Rule

Jun 20th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.10 KB | None | 0 0
  1. %% Specific Loop Rule
  2. % Determines the potential at point A, and the current at i1 and i3.
  3. % Please check the note at the bottom before using this code
  4.  
  5. % Inputs and Variables
  6. E1 = input('What is E1?\n');
  7. E2 = input('What is E2?\n');
  8. R1 = input('What is the resistance in R1?\n');
  9. R3 = input('What is the resistance in R3?\n');
  10.  
  11. % Outputs and Equations
  12. Va = E1;
  13. i1 = (E1-E2)/R1;
  14. i3 = E2/R3;
  15. fprintf(['The potential at Point A, the current at i1, and the current at i3 is\n'...
  16.         '%.3i V, %.3i A, %.3i A'], Va, i1, i3);
  17.  
  18. %{
  19. This is a very specific scenario that may or not be useful
  20.  
  21. This only works if there is a circuit with two electromotive forces(E1 and E2) on
  22.     opposite sides. Point A is in the corner with current i1 coming towards it
  23.     from E1. Point B is somewhere on the same line as point A but with a
  24.     resistor (R1) between them. Current i2 is coming from E2 and runs into point
  25.     B. At point B there is a resistor (R3) that runs parallel to the sides
  26.     that E1 and E2 are on. Current i3 runs from R3 to the opposite end
  27.     where the voltage is 0 at that point.
  28.  
  29. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement