Advertisement
hiddenGem

Resistance and Reactance in an RLC Circuit

Jul 16th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.75 KB | None | 0 0
  1. %% Resistance and Reactance in an RLC Circuit
  2. % Determines the total resistance, total reactance, and average power in a
  3. % circuit
  4.  
  5. % Inputs and Variables
  6. Irms = input('What is the RMS current?\n');
  7. Vrms = input('What is the RMS voltage?\n');
  8. phi = input('How much does the voltage lead the current in degrees?\n')*pi/180;
  9.  
  10. % Outputs and Equations
  11. Z = Vrms/Irms;
  12. R = Z*cos(phi);
  13. X = Z*sin(phi);
  14. P = Vrms*Irms*cos(phi);
  15. fprintf('The resistance, reactance, and average power are:\n %.3e Ohm, %.3e Ohm, and %.3e W \n', R, X, P)
  16.  
  17. %{
  18. For the variable 'phi' if the current leads the voltage enter value as a
  19. negative number. The variable is also entered in degrees but it saved in
  20. radians. To change this feature remove the *pi/180 after the input.
  21. %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement