Advertisement
lucontre

%%euler circuito RLC con EDO segundo grado

Sep 4th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.67 KB | None | 0 0
  1. %%euler circuito RLC con EDO segundo grado
  2. clear all
  3. clc
  4.  
  5. %constantes
  6.  
  7. h=0.001; %sampleo, delta t, tiempo de musetreo , tamaΓ±o de paso ,.. etc
  8. L=440e-3 ;   %inductancia
  9. C=47e-6  ;  %capacitancia
  10. R=100   ;  %resistencia
  11. %conste de simulacion
  12. tFin=2      %[segundos]
  13. kFin=(tFin/h)+1  
  14. orden =2      
  15.  
  16. %valores iniciales
  17. Vc(1)=0;
  18. Vc(2)=0;
  19.  
  20. for k=1:kFin
  21.     %vector tiempo
  22.     t(k)=(k-1)*h;
  23.     %vector volteje entrada
  24.     if t(k)>1
  25.         V(k)=10;
  26.     else
  27.         V(k)=0;
  28.     end
  29.    
  30.     if k <(kFin-orden+1)
  31.         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);
  32.     end
  33.    
  34. end
  35. plot(t,V), hold on
  36. plot(t,Vc,'m'), hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement