AnonymousEng

2013Exam - Q2

Jan 14th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.38 KB | None | 0 0
  1. clear;clc;
  2.  
  3. %setting values of Zeeeez :D
  4. global w %i've used a global var to adjust it as i want :)
  5. w=377;
  6.  
  7. %the zeez :D
  8. Z1 = 20 + i*xl(12e-3); Z2 = 40 + i*xl(60e-3); Z3 = 10 + i*xl(50e-3);
  9. Z4 = 50 - i*xc(10e-6); Z5 = 35 + i*xl(25e-3); Z6 = 60 + i*xl(30e-3);
  10. Z7 = 25 - i*xc(12e-6); Z8 = 15 + i*xl(5e-3);  Z9 = 30 + i*xl(12e-3);
  11. Z10 = 16 - i*xc(7e-6); Z11 = 50 + i*xl(15e-3);
  12.  
  13. %Setting the value of Zx :)
  14. Zx = 20:1:250;
  15.  
  16. %Converting the Vmsin(wt) to complex :)
  17. V1 = (340/sqrt(2))*(cos(pi)+i*sin(pi));
  18. V2 = (340/sqrt(2))*(cos(-pi/2)+i*sin(-pi/2));
  19. V3 = (340/sqrt(2));
  20. V4 = (340/sqrt(2))*(cos(pi/2)+i*sin(pi/2));
  21.  
  22. %creating Z matrix
  23. Z = [ Z1+Z2,-Z2,0,0,0,0,0;
  24.     -Z2,(Z2+Z3+Z4),-Z4,0,0,0,0;
  25.     0,-Z4,0,-Z5,0,0,0;
  26.     0,0,-Z5,(Z11+Z5+Z6),-Z6,0,0;
  27.     0,0,0,-Z6,0,-Z7,0;
  28.     0,0,0,0,-Z7,(Z8+Z9+Z7),-Z9;
  29.     0,0,0,0,0,-Z9,(Z9+Z10)];
  30.  
  31. %Creating V
  32. V = [+V1;-V2;+V2;0;-V3;+V3;-V4];
  33.  
  34. %The loop :)
  35. for k=1:length(Zx)
  36.     Z(3,3)=Z4+Z5+Zx(k);
  37.     Z(3,5)=-Zx(k);
  38.     Z(5,3)=-Zx(k);
  39.     Z(5,5)=Z6+Z7+Zx(k);
  40.    
  41.     I=inv(Z)*V;
  42.    
  43.     %this is the most important part :) focus that >> abs(I3-I5)^2 * Rx <<
  44.     P(k) = (abs(I(3)-I(5)))^2 * real(Zx(k));
  45.    
  46. end
  47. [maxPower,index]=max(P); %as usual
  48.  
  49. %printing the output
  50. fprintf('Max power is = %10.3f Watt \n  and its Zx = %10.3f Ohm \n',maxPower,Zx(index));
  51.  
  52. plot(Zx,P);
  53. xlabel('Zx Value');ylabel('Power Value');
  54. grid;
Advertisement
Add Comment
Please, Sign In to add comment