many pulses.sce 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. xdel(winsid())
  2. clear;
  3. t = [0:0.01:10];
  4. a = 1;
  5. b = 2;
  6. k = 1;
  7. y = k*(exp(-a*t) - exp(-b*t) );
  8. ymax = max(y)*ones(1,length(y));
  9. ylong=[];
  10. tlong=[];
  11. for i = [-1:11]
  12. if(modulo(i, 5) == 0)
  13. disp('yoman!')
  14. ylong = [ylong y];
  15. else
  16. disp('shitdude!')
  17. ylong = [ylong zeros(1,length(y))];
  18. end
  19. end
  20. xlong = [1:length(ylong)];
  21. xpts = [1 1];
  22. ypts = [-1 0];
  23. plot(xpts*1000, ypts, '--');
  24. plot(xpts*6000, ypts, '--');
  25. //plot(xpts*8.96, ypts, '--');
  26. plot(ylong, 'black');
  27. plot(ones(1,length(ylong))*-.01, 'white');
  28. plot(ones(1,length(ylong))*max(ylong)*1.01, 'white');
  29. //plot(t,ymax.*0.9, '--');
  30. // titletxt = ['$y = k(e^{-\alpha t} - e^{-\beta t})$' ; strcat(['$k=', string(k), ', \alpha=', string(a), ', \beta=', string(b), '$']) ];
  31. titletxt = '$y = k(e^{-\alpha t} - e^{-\beta t})$';
  32. title("Consecutive pulses", 'fontsize', 8);
  33. xlabel('t (s)', 'fontsize', 7);
  34. ylabel('U (V)', 'fontsize', 7, 'rotation', 0);
  35. a = get("current_axes");
  36. a.axes_visible = "off";
  37. //a.margins = [0 0 0 0];
  38. //a.zoom_box=[1,-0.01;10013,0.2524975];
  39. a.data_bounds = [1,-0.01;11500,0.2524975];
  40. //zoom_rect([-1,-1,1,1]);