nb=input('no. of buses'); n(th(i)-th(j)-an(i,j))+qu(i); chth(2:nb)=chan(1:1); z=zeros(nb,nb); end for i=2:nb y=zeros(nb,nb); end mag(i)=mag(i)+chan(i); lca=input(' '); for i=2:nb end display('Enter the impedence'); for j=2:nb for a=1:nb if i~=j th=th + chth; for b=1:nb disp(['the voltage magnitudes z(a,b)=input(' '); j1(i,j)=mag(i)*mag(j)*(g(i,j)*sin are:',num2str(mag),]); end (th(i)-th(j))-b(i,j)*cos(th(i)- disp(['the phase value end th(j))); are:' ,num2str(th),]); for a=1:nb j3(i,j)=- for v=1:nb mag(i)*mag(j)*(g(i,j)*cos(th(i)- no. of buses2 if z(a,v)~=0 th(j))-b(i,j)*sin(th(i)-th(j))); 0.0636i y(a,a)=y(a,a)+(1/z(a,v)) Enter the impedence j2(i,j)=-j3(i,j); +lca; 0 j4(i,j)=-j1(i,j); 0.0839+0.5183i end else 0.0839+0.5183i end j1(i,j)=-qu(i)- 0 for b=1:nb b(i,j)*(mag(i)^2); ybus = if(a~=b) j2(i,j)=pe(i) 0.3043 - 1.8165i -0.3043 + if(z(a,b)~=0) +g(i,j)*(mag(i)^2); 1.8801i y(a,b)=(-1/z(a,b)); -0.3043 + 1.8801i 0.3043 - j3(i,j)=pe(i)- end 1.8165i g(i,j)*(mag(i)^2); enyer the voltage magnitude of end j4(i,j)=qu(i)- bus1:1.05 end b(i,j)*(mag(i)^2); enter the angle of the bus1:0 end end enter the real power of bus1:.9 ybus=y end enter the reactive power of for j=1:nb end bus1:.2 mag(j)=input(['enyer the enyer the voltage magnitude of ja1(1:nb-1,1:nb- voltage magnitude of bus2:1 1)=j1(2:nb,2:nb); enter the angle of the bus2:0 bus',num2str(j),':']); ja2(1:nb-1,1:nb- enter the real power of bus2:-.3 th(j)=input(['enter the angle of 1)=j2(2:nb,2:nb); enter the reactive power of the bus',num2str(j),':']) ; ja3(1:nb-1,1:nb- bus2:-.1 acp(j)=input(['enter the real 1)=j3(2:nb,2:nb); the jacobian matrix is : power of bus',num2str(j),':']); ja4(1:nb-1,1:nb- the jacobian matrix is : acq(j)=input(['enter the 1.9741 0.2891 1)=j4(2:nb,2:nb); reactive power of -0.3196 1.6589 jacob=[ja1 ja2; ja3 ja4]; the voltage magnitudes are:1.05 bus',num2str(j),':']); disp(['the jacobian matrix 1.0067 end is :']); the phase value are:0 -0.14525 my=abs(ybus); an=angle(ybus); jacob=[ja1 ja2; ja3 ja4]; g=real(ybus);b=imag(ybus); disp(['the jacobian matrix for i=2:nb; is :']); pe(i)=0; qu(i)=0; disp(jacob); for j=1:nb; delp(1:nb-1)=acp(2:nb)- pe(2:nb); pe(i)=mag(i)*my(i,j)*mag(j)*co delq(1:nb-1)=acq(2:nb)- s(th(i)-th(j)-an(i,j))+pe(i); qu(2:nb);