Advertisement
Guest User

Untitled

a guest
May 24th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.77 KB | None | 0 0
  1. %%%%%%%%%%%%%%%%%%%  PRIMERA PARTE  %%%%%%%%%%%%%%%%%%%%%%%
  2. %Autores:   Felipe Maturana
  3. %           Juan De Pablo
  4.  
  5.  
  6. %%%% Funciones %%%%
  7.  
  8. % Funcion de transferencia ya calculada
  9. nume = [3 25]; %defino numerador
  10. denu = [13 -4 20]; %defino denominador
  11.  
  12. %Respuesta continua en el tiempo
  13. [y1 , i ,t1] = step(nume,denu,10); %resultado y tiempo para graficar , el valor i no lo necesito
  14.  
  15. %Primer discretizacion
  16. t_muestreo1 = 0.05;
  17. [numd1 , dend1 ] = c2dm (nume ,denu ,t_muestreo1 , 'zoh '); %continuo a discreto con primer tiempo de muestreo 0.05
  18. [yd1] = dstep (numd1 ,dend1 ,200+1); %se prepara para graficar
  19. xd1 = 0:0.05:0.05*200; %Esto entrega como resultado 200 puntos.
  20.  
  21. %segunda discretizacion
  22. t_muestreo2 = 0.5;
  23. [numd2 , dend2 ] = c2dm (nume ,denu ,t_muestreo2 , 'zoh '); %continuo a discreto con segundo tiempo de muestreo 0.5
  24. [yd2] = dstep (numd2 ,dend2 ,20+1); %se prepara para graficar
  25. xd2 = 0:0.5:0.5*20; %Esto entrega como resultado 20 puntos.
  26.  
  27. %lo llevo a tiempo continuo nuevamente
  28. [numec, denuc] = d2cm(numd1, dend2, 0.01, 'zoh');
  29. [y2 , i ,t2] = step(numec,denuc,0.2); %resultado y tiempo para graficar una vez llevado al tiempo continuo nuevamente, el valor i no lo necesito
  30.  
  31. %%%% Graficos correspondientes %%%%
  32. % Todo esto es para crear un panel y meter los graficos
  33. f = figure;
  34. p = uipanel('Parent',f,'BorderType','none');
  35. p.Title = 'Step Response';
  36. p.TitlePosition = 'centertop';
  37. p.FontSize = 12;
  38. p.FontWeight = 'bold';
  39.  
  40. subplot(2,2,1, 'Parent', p); %subplot primer grafico
  41. plot(t1,y1, '-'); %primer plot
  42. title('respuesta continua de $13\frac{d^{2}y}{dt^{2}} - 4\frac{dy}{dt} + 20y - 3\frac{du}{dt} - 25u = 0$','Interpreter', 'Latex'); %titulo en latex
  43. ylabel('Amplitude'); %nombre variable y
  44. xlabel('Time (seconds)'); %nombre variable x
  45. grid on; %grilla
  46.  
  47. subplot(2,2,2); %subplot segundo grafico
  48. stairs(xd1, yd1);
  49. title('discretizacion de $13\frac{d^{2}y}{dt^{2}} - 4\frac{dy}{dt} + 20y - 3\frac{du}{dt} - 25u = 0$ con muestreo a 0.05','Interpreter', 'Latex'); %titulo en latex
  50. ylabel('Amplitude'); %nombre variable y
  51. xlabel('Time (seconds)'); %nombre variable x
  52. grid on; %grilla
  53.  
  54. subplot(2,2,3); %subplot tercer grafico
  55. stairs(xd2, yd2);
  56. title('discretizacion de $13\frac{d^{2}y}{dt^{2}} - 4\frac{dy}{dt} + 20y - 3\frac{du}{dt} - 25u = 0$ con muestreo a 0.5','Interpreter', 'Latex'); %titulo en latex
  57. ylabel('Amplitude'); %nombre variable y
  58. xlabel('Time (seconds)'); %nombre variable x
  59. grid on; %grilla
  60.  
  61. subplot(2,2,4, 'Parent', p); %subplot cuarto grafico
  62. plot(t2,y2, '-');
  63. title('devuelta a tiempo continuo de $13\frac{d^{2}y}{dt^{2}} - 4\frac{dy}{dt} + 20y - 3\frac{du}{dt} - 25u = 0$ con muestreo a 0.1','Interpreter', 'Latex'); %titulo en latex
  64. ylabel('Amplitude'); %nombre variable y
  65. xlabel('Time (seconds)'); %nombre variable x
  66. grid on; %grilla
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement