Programa Digi
El programa manda el resultado de un circuito RC, obteniendo las grafica de los voltajes de todos los componentes y sus respectivas potencias.
CODIGO:close all;
clear all;
clc
r=input('resistencia= ');
c=input('capacitor= ');
f=60;
w=2*pi*f;
ta=0.2/f;
t=0:0.001*ta:10*ta;vf=120*sin(w*t);
xc=1/(j*w*c);
z1=xc;
vz1=(120*z1)/(z1+r);
vr=(120*r)/(z1+r);
zt=z1+r;
it=120/zt;vr2=abs(it)*sin((w*t)+angle(it)).*r;
i1=vz1/xc;
%pc=vz1*i1;
pc2=(abs(vz1).*sin((w.*t)+angle(vz1)).*abs(i1).*sin((w.*t)+angle(i1)))./2;
%pr=(vr).^2./r;pr2=(vr2.*abs(it).*sin((w.*t)+angle(it)))./2;
%pt=(vr+vz1).*it;
pt2=(abs(it)*sin((w*t)+angle(it)).*170.*sin(377.*t))./2;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
plot(t,abs(vr)*sin((w*t)+angle(vr)),'b','linewidth',1); grid on;
hold on
plot(t,abs(vz1)*sin((w*t)+angle(vz1)),'r','linewidth',1);grid on;
hold on
plot(t,170*sin((w*t)),'k','linewidth',1); grid on;
hold on
plot(t,abs(it*1500)*sin((w*t)+angle(it)),'g','linewidth',1); grid on;
hold ontitle('VOLTAJES Y CORRIENTE')
xlabel('Tiempo')
ylabel('Amplitud')
legend('Vr','Vc','Vt','It')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(2)
plot(t,pc2,'b','linewidth',1); grid on;
hold on
plot(t,pr2,'r','linewidth',1); grid on;
hold on
plot(t,pt2,'k','linewidth',1); grid on;
hold onplot(t,(120/100)*sin((w*t)),'g','linewidth',1); grid on;
hold on
title('POTENCIAS')
xlabel('Tiempo')
ylabel('Amplitud')
legend('Pc','Pr','Pt','Vt')
GRAFICAS:
Regístrate para leer el documento completo.