Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Multimeter in a Wheatstone Bridge
- % Calculate the magnitude of the voltage when the multi-meter is set to
- % voltmeter and the current when in ammeter mode. Notes and clarifications
- % are at the end
- % Inputs and Variables
- R = input('Enter the resistances of resistors 1-4 in brackets\n');
- E = input('Value of E in volts\n');
- % Outputs and Equations
- mag = E*((R(2)*R(3)-R(1)*R(4))/((R(2)+R(1))*(R(3)+R(4))));
- c = R(1)*R(3)/(R(1)+R(3));
- d = R(2)*R(4)/(R(2)+R(4));
- i = E/(c+d);
- i1 = i*c/R(1);
- i2 = i*d/R(2);
- ia = i1-i2;
- fprintf('The magnitudes in voltmeter and ammeter mode are :\n %.03f V and %.3e A \n', mag, ia);
- %{
- When the user inputs the resistances they have to be in brackets [] otherwise
- the code will not work.
- Usually variables will have interesting names so that the user will be able to
- follow along. However, there was a lot of different steps to solve the
- equation so variables 'c' and 'd' are just place holders so that the code
- wasn't too clutter in each line.
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement