Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% AC Circuit with R and C
- % Determines the RMS current, RMS voltage across the resistor and
- % capacitor, and the phase angle for the circuit
- % Inputs and Variables
- C = input('What is the capacitance?\n');
- R = input('What is the resistance?\n');
- Vrms = input('What is the voltage RMS output?\n');
- f = input('What is the frequency? \n');
- % Outputs and Equations
- Xc = 1/(2*pi*f*C);
- Irms = Vrms/sqrt(R^2+Xc^2);
- phi = atan(-Xc/R);
- VrRMS = Vrms*cos(phi);
- VcRMS = -Vrms*sin(phi);
- fprintf(['The RMS values for the current, voltage across resistor and capacitor, and phase angle are:\n',...
- '%.3e A, %.3e V, %.3e V, %.3e rad'],Irms, VrRMS, VcRMS, phi)
- %{
- The trig functions and phase angle are calculated using radians. To change
- this adjust the trig functions to read atand, cosd, and sind. Also change
- the second fprintf line to read degrees
- %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement