Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%euler circuito RLC con EDO segundo grado
- clear all
- clc
- %constantes
- h=0.0001; %sampleo, delta t, tiempo de musetreo , tamaΓ±o de paso ,.. etc
- L=440e-3 ; %inductancia
- C=47e-6 ; %capacitancia
- R=100 ; %resistencia
- %conste de simulacion
- tFin=2 %[segundos]
- kFin=(tFin/h)+1
- orden =1
- %valores iniciales
- x1(1)=0;
- x2(1)=0;
- for k=1:kFin
- %vector tiempo
- t(k)=(k-1)*h;
- %vector volteje entrada
- if t(k)>1
- V(k)=50*sin(2*pi*1000*t(k));
- else
- V(k)=0;
- end
- if k <(kFin-orden+1)
- % Vc(k+2)=(h^2/(L*C))*V(k) + (2-R*h/L)*Vc(k+1)+(-1-(h^2/(L*C))+(R/L)*h)*Vc(k);
- x1(k+1)= x1(k) + x2(k)*h;
- x2(k+1)= (h/(L*C))*V(k) - (h/(L*C))*x1(k) + (1-(R*h/L))*x2(k);
- end
- end
- Vc=x1;
- figure(2)
- plot(t,V), hold on
- plot(t,Vc,'m'), hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement