Advertisement
hiddenGem

Multimeter in a Wheatstone Bridge

Jun 21st, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.00 KB | None | 0 0
  1. %% Multimeter in a Wheatstone Bridge
  2. % Calculate the magnitude of the voltage when the multi-meter is set to
  3. %   voltmeter and the current when in ammeter mode. Notes and clarifications
  4. %   are at the end
  5.  
  6. % Inputs and Variables
  7. R = input('Enter the resistances of resistors 1-4 in brackets\n');
  8. E = input('Value of E in volts\n');
  9.  
  10. % Outputs and Equations
  11. mag = E*((R(2)*R(3)-R(1)*R(4))/((R(2)+R(1))*(R(3)+R(4))));
  12. c = R(1)*R(3)/(R(1)+R(3));
  13. d = R(2)*R(4)/(R(2)+R(4));    
  14. i = E/(c+d);
  15. i1 = i*c/R(1);
  16. i2 = i*d/R(2);
  17. ia = i1-i2;
  18. fprintf('The magnitudes in voltmeter and ammeter mode are :\n %.03f V and %.3e A \n', mag, ia);
  19.  
  20. %{
  21. When the user inputs the resistances they have to be in brackets [] otherwise
  22.     the code will not work.
  23. Usually variables will have interesting names so that the user will be able to
  24.     follow along. However, there was a lot of different steps to solve the
  25.     equation so variables 'c' and 'd' are just place holders so that the code
  26.     wasn't too clutter in each line.
  27.  
  28. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement