Advertisement
Liza-kiwara

task2dwithPG

Nov 12th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. clear
  2. clc
  3.  
  4. V1=1.01;
  5. PG=0.6;
  6. PSOP=0;
  7. QSOP2=0;
  8. QSOP4=0;
  9.  
  10. ZL12=0.05+i*0.01;
  11. ZL13=0.04;
  12. ZL34=0.01;
  13. Zload3=2.21;
  14. Zload4=2.08+i*0.52;
  15.  
  16. YL12=1/ZL12;
  17. YL13=1/ZL13;
  18. YL34=1/ZL34;
  19. Yload3=1/Zload3;
  20. Yload4=1/Zload4;
  21.  
  22. Y=[YL12+YL13,-YL12,-YL13,0;
  23. -YL12,YL12,0,0;
  24. -YL13,0,YL13+YL34+Yload3,-YL34;
  25. 0,0,-YL34,YL34+Yload4];
  26.  
  27. G12=real(Y(1,2));
  28. B12=imag(Y(1,2));
  29.  
  30. G13=real(Y(1,3));
  31. B13=imag(Y(1,3));
  32.  
  33. G22=real(Y(2,2));
  34. B22=imag(Y(2,2));
  35.  
  36. G33=real(Y(3,3));
  37. B33=imag(Y(3,3));
  38.  
  39. G34=real(Y(3,4));
  40. B34=imag(Y(3,4));
  41.  
  42. G44=real(Y(4,4));
  43. B44=imag(Y(4,4));
  44.  
  45. for PSOP=0:0.001:1
  46. f=@(V2,V3,V4,theta2,theta3,theta4) [V1*V2*(G12*cos(theta2)+B12*sin(theta2))+V2*V2*G22-PG+PSOP; V1*V3*(G13*cos(theta3)+B13*sin(theta3))+V3*V3*G33+V3*V4*(G34*cos(theta3-theta4)+B34*sin(theta3-theta4)); V3*V4*(G34*cos(theta4-theta3)+B34*sin(theta4-theta3))+V4*V4*G44-PSOP; V1*V2*(G12*sin(theta2)-B12*cos(theta2))-V2*V2*B22+QSOP2; V1*V3*(G13*sin(theta3)-B13*cos(theta3))-V3*V3*B33+V3*V4*(G34*sin(theta3-theta4)-B34*cos(theta3-theta4)); V3*V4*(G34*sin(theta4-theta3)-B34*cos(theta4-theta3))-V4*V4*B44-QSOP4];
  47.  
  48. fp=@(x) f(x(1),x(2),x(3),x(4),x(5),x(6));
  49.  
  50. [x, fval, info] = fsolve (fp, [1.01;1.01;1.01;0;0;0]);
  51.  
  52. disp(x);
  53.  
  54. V2=x(1);
  55. V3=x(2);
  56. V4=x(3);
  57. theta2=x(4);
  58. theta3=x(5);
  59. theta4=x(6);
  60.  
  61. if x(1)>0.98&&x(2)>0.98&&x(3)>0.98&&x(1)<1.02&&x(2)<1.02&&x(3)<1.02
  62. disp(PSOP);
  63. break;
  64. else
  65. continue;
  66. end
  67. end
  68. for PSOP=0.3960:0.001:2
  69. f=@(V2,V3,V4,theta2,theta3,theta4) [V1*V2*(G12*cos(theta2)+B12*sin(theta2))+V2*V2*G22-PG+PSOP; V1*V3*(G13*cos(theta3)+B13*sin(theta3))+V3*V3*G33+V3*V4*(G34*cos(theta3-theta4)+B34*sin(theta3-theta4)); V3*V4*(G34*cos(theta4-theta3)+B34*sin(theta4-theta3))+V4*V4*G44-PSOP; V1*V2*(G12*sin(theta2)-B12*cos(theta2))-V2*V2*B22+QSOP2; V1*V3*(G13*sin(theta3)-B13*cos(theta3))-V3*V3*B33+V3*V4*(G34*sin(theta3-theta4)-B34*cos(theta3-theta4)); V3*V4*(G34*sin(theta4-theta3)-B34*cos(theta4-theta3))-V4*V4*B44-QSOP4];
  70.  
  71. fp=@(x) f(x(1),x(2),x(3),x(4),x(5),x(6));
  72.  
  73. [x, fval, info] = fsolve (fp, [1.01;1.01;1.01;0;0;0]);
  74.  
  75. disp(x);
  76.  
  77. V2=x(1);
  78. V3=x(2);
  79. V4=x(3);
  80. theta2=x(4);
  81. theta3=x(5);
  82. theta4=x(6);
  83.  
  84. if x(1)<0.98||x(2)<0.98||x(3)<0.98||x(1)>1.02||x(2)>1.02||x(3)>1.02
  85. disp(PSOP);
  86. break;
  87. else
  88. continue;
  89. end
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement