Info

This question is closed. Reopen it to edit or answer.

Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in TR1 (line 76) Jcob=[J1 J2;J3 J4;J5 J6];

1 view (last 30 days)
clc;
YBUS
IP_DATA
e=busdata(:,3);
f=busdata(:,11);
V=e+1i*f;
g=real(ybus);
b=imag(ybus);
y=g+1i*b;
J1=zeros(1,n);
for i=1:nbus
for k=1:nbus
if i==k
J1(i,i)=2*e(i)*g(i,i)+g(i,k)*e(k)-f(k)*b(i,k);
else
J1(i,k)= (e(i)*g(k,i)+f(i)*b(i,k));
end
end
end
J1;
% J1 Calculation
for i=1:nbus
for k=1:nbus
if i==k
J2(i,i)=2*f(i)*g(i,i)+g(i,k)*f(k)+b(i,k)*e(k);
else
J2(i,k)=f(i)*g(i,k)-e(i)*b(i,k);
end
end
end
J2;
% J2 Calculation
for i=2:nbus
for k=1:nbus
if i==k
J3(i,i)=-2*e(i)*b(i,i)-f(k)*g(i,k)-b(i,k)*e(k);
else
J3(i,k)=e(i)*b(i,k)+f(i)*g(i,k);
end
end
end
J3;
% J3 Calculated
for i=2:nbus
for k=1:nbus
if i==k
J4(i,i)=-2*f(i)*b(i,i)-f(k)*b(i,k)+g(i,k)*e(k);
else
J4(i,k)=-e(i)*g(i,k)+f(i)*b(i,i);
end
end
end
J4;
for i=2:nbus
for k=2:nbus
if i==k
J5= 2*e(i);
else
J5=0;
end
end
end
J5;
for i=2:nbus
for k=2:nbus
if i==k
J6= 2*f(i);
else
J6=0;
end
end
end
J6;
% Jacobian matrix
Jcob=[J1 J2;J3 J4;J5 J6];
I didn't know how to set J5 and J6 matrix same arrays as of J1,J2,J3 and J4.
Please help.

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!