Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Balanced Wheatstone
- % Calculates the resistance in R1
- % Notes and clarifications are at the bottom of the code
- % Inputs and Variables
- Rsub = input('Input the values of R2, R3, and R4 in brackets\n');
- for i = 1:3
- R(i+1) = Rsub(i)
- end
- % Outputs and Equations
- R(1) = R(2)*R(3)/R(4);
- fprintf('The resistance of R1 is %.3f', R(1))
- %{
- Later versions will allow users to choose which resistor the user would
- like to solve for.
- In this scenario, the circuit runs between R1 and R3 and R2 and R4. R1 and
- R3 are on the left side and R1 and R2 are on the top side.
- When the user inputs values R2-4, they will take the first 3 spots of the
- array 'Rsub'. The for loop will put the resistance values in their corresponding
- place in the array 'R'
- The user must input the values of the known resistances in brackets [] for
- the code to work.
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement