Advertisement
Guest User

Untitled

a guest
Dec 19th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. EH= 0.67;
  2. EL= -0.33;
  3.  
  4. syms Va Vb Js n
  5.  
  6. T=1/100;
  7. w=2*pi/T;
  8. R23= -(R2+R3)/(R2*R3);
  9. e1=Va+(K*(Vb-Va)*R3)/(R23)(R2+R3);
  10. e2=(Vb-Va)/R23+Vb*i*n*w*C2-Js;
  11. sol=solve(e1,e2,'Va,Vb');
  12. Va=sol.Va
  13. Vb=sol.Vb
  14.  
  15. iR23= (Vb-Va)/R23
  16. iR2= -(iR23*R3)/(R2+R3)
  17.  
  18. HR23=iR23/Js;
  19. HR2=-(H23*R3)/(R2+R3)
  20.  
  21.  
  22. alfa = 0.05; %coefficiente di attenuazione
  23.  
  24. N=round(sqrt(500^2-(alfa^2)*1000^2)/(3*alfa*w));
  25. clear mHR2
  26. for n=1:N
  27. mHR2(n)=abs(subs(HR2));
  28. end
  29.  
  30. figure, plot(mHR2,'o'), grid on, dock
  31.  
  32. clear n
  33. syms n
  34.  
  35. %Serie di fourier, costruire l'ingresso.
  36. t1=0.33*T;
  37.  
  38. I0 = 0; %Valore medio nullo
  39. An_sym=2/T*(int(EH*cos(n*w*t),t,0,t1)+int(EL*cos(n*w*t),t,t1,T));
  40. Bn_sym=2/T*(int(EH*sin(n*w*t),t,0,t1)+int(EL*sin(n*w*t),t,t1,T));
  41.  
  42. J_t=I0; %termine costante ingresso
  43. iR2_0= subs(HR2,'n',0)*E0; %termine costante uscita
  44. iR2_t= iR2_0;
  45.  
  46. vet_FCn= zeros(N,1);
  47. vet_HR2=zeros(N,1);
  48. vet_FiR2=zeros(N,1);
  49. vet_N=[1:1:N]';
  50. for n=1:N
  51. %ingresso
  52. An=subs(An_sym); %l'integrale รจ in n, con la subs ad ogni iterazione sostituisce la n.
  53. Bn=subs(Bn_sym);
  54. FCn=An-i*Bn;
  55. J_t=J_t+vpa(abs(FCn)*cos(w*n*t+angle(FCn))); %serie fourier ingresso
  56.  
  57. %uscita iR2
  58. HR2n=subs(HR2);
  59. FiR2_Cn=HR2n* FCn;
  60. iR2_n= vpa(abs(FiR2_Cn)*cos(n*w*t+angle(FiR2_Cn))); %componenti uscita
  61.  
  62. iR2_t= iR2_t + iR2_n; %serie fourier uscita
  63.  
  64. vet_FCn(n)= abs(FCn);
  65. vet_HR2(n)=abs(HR2n);
  66. vet_FiR2(n)=abs(FiR2_Cn);
  67. end
  68.  
  69. figure (4), hj= ezplot(J_t,[0,2*T]),grid on, dock, axis auto, hold on
  70. figure (4), hr= ezplot(iR2_t,[0,2*T]),grid on, dock, axis auto
  71.  
  72. set(hj,'color','r'), set(hr,'color','b')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement