Advertisement
Frads01

Untitled

Sep 20th, 2023
1,022
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.93 KB | None | 0 0
  1. close all;
  2. clear all;
  3. clc;
  4.  
  5. s=tf('s');
  6. F1=5/s; %h=1
  7. F2=(s+20)/((s+1)*(s+5)^2); %h=0
  8. K1=dcgain(s*F1);
  9. K2=dcgain(F2);
  10. Kr=1;
  11. d1=0.5;
  12. alpha2=0.1;
  13.  
  14. %% SPECIFICHE STATICHE
  15. Kca=Kr/(0.05*K1*K2);
  16. Kcc=0.1/(0.01*K1*K2);
  17.  
  18. Kc=5;
  19.  
  20. %% SPECIFICHE DINAMICHE
  21. ts=1; % compreso tra 0.8 e 1.2
  22. wBmin=3/ts;
  23. wcd=0.63*wBmin %compreso tra 1.51 e 2.27
  24.  
  25. Mrdb=2.5;
  26. mp_min=60-5*Mrdb
  27.  
  28. %% Inserimento reti
  29. Ga=Kc*F1*F2;
  30. figure,bode(F1*F2);
  31. [m0,f0]=bode(Ga,wcd)
  32. %bode a -188, scelgo di recuperare 10+50=circa 60 gradi
  33.  
  34. md1=4;
  35. xd1=1;
  36. taud1=xd1/wcd;
  37. Rd1=(1+taud1*s)/(1+s*taud1/md1);
  38. Ga2=Ga*Rd1^2;
  39. [m2,f2]=bode(Ga2, wcd)
  40.  
  41. %rete attenuatrice da 8.2
  42. mi=8.2;
  43. mi_db=20*log10(mi)
  44. bode((1+s/mi)/(1+s))
  45. xi=150;
  46. taui=xi/wcd;
  47. Ri = (s*taui/mi+1)/(s*taui+1);
  48. Ga3=Ga2*Ri;
  49. [m2,f2]=bode(Ga3, wcd)
  50.  
  51. figure,margin(Ga3);
  52. Cs=Kc*Rd1^2*Ri;
  53. Wy=feedback(Cs*F1*F2, 1/Kr);
  54. figure,bode(Wy);
  55. figure,step(Wy);
  56.  
  57. Werr=feedback(Ga3,1)
  58. Err_perm=dcgain(s*Werr*1/s^2)
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement