Advertisement
hiddenGem

The Power and Power Factor of an AC Circuit

Jul 16th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.73 KB | None | 0 0
  1. %% The Power and Power Factor of an AC Circuit
  2. % Determines the power factor and average power with a capacitor and then
  3. % an inductor
  4.  
  5. % Inputs and Variables
  6. R = input('What is the resistance?\n');
  7. C = input('What is the capacitance?\n');
  8. V = input('What is the RMS voltage?\n');
  9. f = input('What is the frequency?\n');
  10. L = input('What is the inductance replacing the capacitor?\n');
  11.  
  12. % Outputs and Equations
  13. w = f*2*pi;
  14. Xc = 1/(w*C);
  15. Zc = sqrt(R^2+Xc^2);
  16. PFc = R/Zc;
  17. Irms = V/Zc;
  18. Pc = V*Irms*PFc;
  19. Xl = (w*L);
  20. Zl = sqrt(R^2+Xl^2);
  21. PFl = R/Zl;
  22. Irms = V/Zl;
  23. Pl = V*Irms*PFl;
  24. fprintf(['The power factor and average power with a capacitor and inductor are:\n',...
  25.          '%.3e, %.3e W, %.3e, %.3e W\n'],PFc, Pc, PFl, Pl )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement