syms mV1 aV1 mV2 aV2 mV3 aV3syms mY21 aY21 mY22 aY22 mY23 aY23syms mY31 aY31 mY32 aY32 mY33 aY33P2j = mV2*mV1*mY21*cos(aY21-aV2+aV1) + mV2*mV2*mY22*cos(aY22); Q2j = -mV2*mV1*mY21*sin(aY21-aV2+aV1) - mV2*mV2*mY22*sin(aY22); J = jacobian([P2j,Q2j],[aV2,mV2]);Y =[20-40i -20+40i;-20+40i 20-40i;];V1 = 1.0;V2 = 1.0;S2 = -(2+4i);aV2 = 0;mV2 = 1;X = [aV2;mV2];mV1 = 1.0; aV1 = 0;mY12 = abs(Y(1,1)); aY12 = angle(Y(1,1));mY11 = abs(Y(1,1)); aY11 = angle(Y(1,1));dP2 = real(S2) - eval(P2j);dQ2 = imag(S2) - eval(Q2j);dC = [dP2;dQ2];error = sum(abs(dC));maxMis = 0.0005;iter = 0;while error>=maxMis && iter<10 <---------%%%%%error is here!!
iter = iter+1; Jx = eval(J) dX = Jx\dC; X = X+dX; aV2 = X(1,1); mV2 = X(2,1); dP2 = real(S2) - eval(P2j); dQ2 = imag(S2) - eval(Q2j); dC = [dP2;dQ2]; G = [eval(P2j);eval(Q2j)]; error = sum(abs(dC)); Q1 = -mV1*mV1*mY11*sin(aY11) - mV1*mV2*mY12*sin(aY12); P1 = mV1*mV1*mY11*cos(aY11) + mV1*mV2*mY12*cos(aY12); H = [Q1;P1]; S12 = V1*(conj(V1)-conj(V2))*(-20+40i); S21 = V2*(conj(V2)-conj(V1))*(-20+40i); Sl =[S12;S21]; fprintf('%g',iter), disp([dC,G,X,H,Sl])end
After running program, it said
Conversion to logical from sym is not possible.Error in Project1 (line 32)while error>=maxMis && iter<10
Best Answer