Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.77 KB | None | 0 0
  1. % Define the voltage source
  2. Vs = 1;
  3. % Define the capacitor in the circuit
  4. L=0.2;
  5.  
  6. % Define the time lapse that we're going to explore
  7. t = 0:0.00001: 0.002;
  8.  
  9.  
  10. % Define the resistors in each time constant and
  11. % calculate the voltage across the capacitor
  12.  
  13.  
  14. %L1=100e-3;
  15. R1=500;
  16. V1 = Vs * exp(-R1*t/L);
  17.  
  18.  
  19.  
  20. %L2=200e-3;
  21. R2=1000;
  22. V2 = Vs * exp(-R2*t/L);
  23.  
  24.  
  25. %L3=300e-3;
  26. R3=1500;
  27. V3 = Vs * exp(-R3*t/L);
  28.  
  29.  
  30. % Plot the responses, all at once
  31. plot(t, V1, 'k-', t, V2, 'b', t, V3, 'r')
  32. grid on
  33. title('Oscylogram dla układu RL')
  34. xlabel('Czas (s)')
  35. ylabel('Napięcie (V)')
  36. legend(['RL_1 = ' num2str(R1),' Om, ' num2str(L), 'H'],...
  37.        ['RL_2 = ' num2str(R2),' Om, ' num2str(L), 'H'],...
  38.        ['RL_3 = ' num2str(R3),' Om, ' num2str(L), 'H'], 'location', 'best')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement