Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Resistor Connected to a Real Battery
- % Calculates the internal resistance r, the electric current, the power
- % dissipated by the external resistor and battery, and the efficiency of
- % the circuit
- % Inputs and Variables
- R = input('Resistance of the resistor in Ohms\n');
- epsilon = input('What is the electromotive force in Volts?\n');
- deltaVt = input('The terminal voltage drop in Volts\n');
- % Outputs and Equations
- I = deltaVt/R;
- r = (epsilon-deltaVt)/I;
- PR = R*I^2;
- Pr = r*I^2;
- Eff = PR/(Pr+PR);
- fprintf(['The internal resistance, electric current, power dissipated by \n '...
- 'the external and internal resistor, and the efficiency are \n', ...
- '%.4e Ohm, %.3i A, %.3i W, %.3i W, %.3i \n'], r, I, Pr, PR, Eff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement