Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Temario:
# Ventanas
1 Current folder
2 Editor
Dirección carpeta de trabajo 3 Command History
4 Workspace
5 Command Windows
1 2
4 5
Conceptos generales: Interfaz del programa
Barra de Menús.
Menú de gráficas
Conceptos generales: Interfaz del programa
Conceptos generales: Interfaz del programa
Apps
Conceptos generales: Interfaz del programa
Library Compiler
Conceptos generales: Interfaz del programa
Add-Ons -Explorer
1. Fundamentos del lenguaje: Entrada de comandos, construir y ejecutar sentencias MATLAB
Comandos de ayuda
help Busca información de las funciones en el command windows
doc Documentación, ayuda de Matlab
Conceptos generales: Interfaz del programa
ejemplos
X = zeros(4) T = true(4,4)
X =
T =
0 0 0 0
4×4 logical array
0 0 0 0
0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1
1 1 1 1
1 1 1 1
X=ones(3,5)
T = false(4,4)
X =
1 1 1 1 1 T =
1 1 1 1 1
1 1 1 1 1 4×4 logical array
0 0 0 0
X = rand(3,5) 0 0 0 0
0 0 0 0
0 0 0 0
X =
E = eye(4,4)
0.1062 0.4897 0.9203 0.2691 0.9427
0.3724 0.3395 0.0527 0.4228 0.4177
0.1981 0.9516 0.7379 0.5479 0.9831 E =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
1. Fundamentos del lenguaje : Matrices y Arreglos
ejemplos
A1 = ones(2,2);
X = rand(4,4)
A2 = 2*ones(3,2);
Diag(X)
A3 = 3*ones(2,3);
X = ans = B = blkdiag(A1,A2,A3)
B =
0.4607 0.6448 0.4820 0.3846 0.4607
0.9816 0.3763 0.1206 0.5830 0.3763 1 1 0 0 0 0 0
0.1564 0.1909 0.5895 0.2518 0.5895 1 1 0 0 0 0 0
0.8555 0.4283 0.2262 0.2904 0.2904 0 0 2 2 0 0 0
0 0 2 2 0 0 0
v = [2 1 -1 -2 -5]; 0 0 2 2 0 0 0
D = diag(v); 0 0 0 0 3 3 3
0 0 0 0 3 3 3
D = A=[1 2;3 4]
B=[5 6; 7 8]
2 0 0 0 0 cat(1,A,B)
0 1 0 0 0 cat(2,A,B)
0 0 -1 0 0
0 0 0 -2 0
0 0 0 0 -5 >> A=[1 2;3 4] >> cat(1,A,B)
A = ans =
D1 = diag(v,1)
1 2 1 2
3 4 3 4
D1 = 5 6
>> B=[5 6; 7 8] 7 8
0 2 0 0 0 0
0 0 1 0 0 0 B = >> cat(2,A,B)
0 0 0 -1 0 0
0 0 0 0 -2 0 5 6 ans =
0 0 0 0 0 -5 7 8
0 0 0 0 0 0 1 2 5 6
3 4 7 8
1. Fundamentos del lenguaje : Matrices y Arreglos
ejemplos
A=rand(2,2); A=rand(3,5);
repmat(A,3,2); numel(A)
A = ans = A = ans =
0.6171 0.8244 0.6171 0.8244 0.6171 0.8244 0.8419 0.6135 0.8699 0.1192 0.4795 15
0.2653 0.9827 0.2653 0.9827 0.2653 0.9827 0.8329 0.5822 0.2648 0.9398 0.6393
0.6171 0.8244 0.6171 0.8244 0.2564 0.5407 0.3181 0.6456 0.5447
0.2653 0.9827 0.2653 0.9827
0.6171 0.8244 0.6171 0.8244
0.2653 0.9827 0.2653 0.9827 A=rand(3,5);
numel(A)
A=rand(2,5);
length(A) A = ans =
Size(A)
0.8419 0.6135 0.8699 0.1192 0.4795 15
ans = ans = 0.8329 0.5822 0.2648 0.9398 0.6393
0.2564 0.5407 0.3181 0.6456 0.5447
5 2 5
B=[1 2 3 4];
B=rand(2,2,2); issorted(B)
ndims(B);
ans =
>> B=rand(2,2,2)
ans =
logical
B(:,:,1) =
3
1
0.6073 0.4587
0.4501 0.6619
B(:,:,2) =
0.7703 0.6620
0.3502 0.4162
1. Fundamentos del lenguaje : Matrices y Arreglos
ejemplos
A=[1 2 3 4 5];
C=[1 2 3 4; 5 3 6 8; 9 8 7 6];
isrow(A)
issortedrows(C,1)
iscolumn(A)
A = ans = isempty(A)
A =
0.6171 0.8244 0.6171 0.8244 0.6171 0.8244
0.2653 0.9827 0.2653 0.9827 0.2653 0.9827 1 2 3 4 5
0.6171 0.8244 0.6171 0.8244
0.2653 0.9827 0.2653 0.9827 >> isrow(A) >> iscolumn(A)
0.6171 0.8244 0.6171 0.8244
0.2653 0.9827 0.2653 0.9827 ans = ans =
>> A=rand(2,2,2)
ismatrix(A)
A(:,:,1) =
ans =
0.8217 0.8878
0.4299 0.3912 logical
0
A(:,:,2) =
0.7691 0.8085
0.3968 0.7551
1. Fundamentos del lenguaje : Matrices y Arreglos
ejemplos
linspace(10,20,5);
surf(X,Y,Z)
ans =
x = 1:3;
y = 1:5;
[X,Y] = meshgrid(x,y)
x = y =
1 2 3 1 2 3 4 5
X = Y =
1 2 3 1 1 1
1 2 3 2 2 2
1 2 3 3 3 3
1 2 3 4 4 4
1 2 3 5 5 5
Z=X.^2 + Y.^2
Z =
2 5 10
5 8 13
10 13 18
17 20 25
26 29 34
1. Fundamentos del lenguaje : Matrices y Arreglos
𝑎1,1 𝑎1,2 𝑎1,3 𝑎1,4 𝑎1,5 𝑎1,𝑛 𝑎1,1 𝑎1,2 𝑎1,3 𝑎1,4 𝑎1,5 𝑎1,𝑛
𝑎2,1 𝑎2,2 𝑎2,3 𝑎2,4 𝑎2,5 𝑎2,𝑛 𝑎2,1 𝑎2,2 𝑎2,3 𝑎2,4 𝑎2,5 𝑎2,𝑛
𝑎3,1 𝑎3,2 𝑎3,3 𝑎3,4 𝑎3,5 ⋯ 𝑎3,𝑛 𝑎3,1 𝑎3,2 𝑎3,3 𝑎3,4 𝑎3,5 ⋯ 𝑎3,𝑛
𝐴= 𝑎4,1 𝑎4,2 𝑎4,3 𝑎4,4 𝑎4,5 𝑎4,𝑛 𝐴= 𝑎4,1 𝑎4,2 𝑎4,3 𝑎4,4 𝑎4,5 𝑎4,𝑛
𝑎5,1 𝑎5,2 𝑎5,3 𝑎5,4 𝑎5,5 𝑎5,𝑛 𝑎5,1 𝑎5,2 𝑎5,3 𝑎5,4 𝑎5,5 𝑎5,𝑛
⋮ ⋱ ⋮ ⋮ ⋱ ⋮
𝑎𝑚,1 𝑎𝑚,2 𝑎𝑚,3 𝑎𝑚,4 𝑎𝑚,5 ⋯ 𝑎𝑚,𝑛 𝑎𝑚,1 𝑎𝑚,2 𝑎𝑚,3 𝑎𝑚,4 𝑎𝑚,5 ⋯ 𝑎𝑚,𝑛
Operadores Aritméticos
Ejemplo:
Aplicación 01: Corrientes de secuencia Corrientes de falla monofásica, fase A, (5 ohm)
%corrientes de sacuencia +-0
Ia=1167*cosd(-7.8)+j*1167*sind(-7.8);
Ib=106*cosd(-129.3)+j*106*sind(-129.3);
Ic=106*cosd(108.2)+j*106*sind(108.2);
In=Ia+Ib+Ic;
Corrientes prefalla Iabc=[Ia;Ib;Ic];
a=(-1/2+j*sqrt(3)/2);
%corrientes de secuencia +-0 A=[1 1 1;1 a^2 a;1 a a^2];
Ia=107*cosd(-10.6)+j*107*sind(-10.6); I012=A^(-1)*(Iabc);
Ib=107*cosd(-130.6)+j*107*sind(-130.6);
Ic=107*cosd(109.3)+j*107*sind(109.3); >> Iabc >> In
In=Ia+Ib+Ic; Iabc =
In =
Iabc=[Ia;Ib;Ic];
1.0e+03 *
a=(-1/2+j*sqrt(3)/2);
1.0560e+03 - 1.3971e+02i
A=[1 1 1;1 a^2 a;1 a a^2]; 1.1562 - 0.1584i
I012=A^(-1)*(Iabc); -0.0671 - 0.0820i
>> Iabc >> In -0.0331 + 0.1007i
Iabc =
In = >> I012
1.0e+02 * I012 =
0.1762 + 0.0619i
1.0517 - 0.1968i 1.0e+02 *
-0.6963 - 0.8124i
-0.3537 + 1.0099i 3.5199 - 0.4657i
4.5486 - 0.6573i
>> I012 3.4936 - 0.4608i
I012 =
1.0e+02 *
0.0006 + 0.0002i
1.0516 - 0.1974i
-0.0005 + 0.0004i
1. Fundamentos del lenguaje : Matrices y Arreglos
Flujo de potencia
Tipos de
datos
Manipulador Contenedor
Booleano Numérico texto
de Función Heterogéneo
Logico char
function_handle
(1 byte) (2 byte)
ejemplos
A= 1234;
B=single(A); A={1234,'hola mundo',datetime('30/08/2020')}
whos
Name Size Bytes Class Attributes A =
fh 1x1 32 function_handle
y 1x1 8 double
z 1x1 8 double
1. Fundamentos del lenguaje: Bucles y declaraciones condicionales
Sentencias de Control Selectivas Simple: if … else
if condición if condición
sentencia(s)1
else else
sentencia(s)2 sentencia(s)2
end end
x = 10;
minVal = 2;
maxVal = 6;
if cond. 1
sentencia. 1
elseif cond. 2 Resultado línea corta
sentencia. 2
:
elseif cond. N
sentencia. N
else Resultado línea media
sent. por defecto
end
1. Fundamentos del lenguaje: Bucles y declaraciones condicionales
for rango(k)
sentencia(s)
end
𝑛
𝜕𝑃𝑖
= 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . sin 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘
𝜕𝛿𝑖
𝑘=1
clc;clear;
Ybus=[8.9851 -44.8359i,-3.8156 + 19.0781i,-5.1695 + 25.8478i,0.00000 + 0.0000i;
-3.8156 + 19.0781i,8.9851 - 44.8359i,0.0000 + 0.0000i,-5.1695 + 25.8478i;
-5.1695 + 25.8478i,0.0000 + 0.0000i,8.1932 - 40.8638i,-3.0237 + 15.1185i;
0.00000 + 0.0000i,-5.1695 + 25.8478i,-3.0237 + 15.118i,8.1932 - 40.8638i];
V =[1.0000;1.0000;1.0000;1.0200];
ang=[0 0 0 0];
i=1;
SJ11=0;
mg=[2 3 4 2 3];
%flujo de potencia
clear;clc; 1 2
%datos de barras---------------------------------------------
% b,Pg,Qg,Pc,Qc,V,delta,tipo Barra: 1.slack 2.carga 3.generador
D=[1 0.00 0 0.5 0.3099 1.00 0 1;
2 0.00 0 1.7 1.0535 1.00 0 2;
3 0.00 0 2.0 1.2394 1.00 0 2;
4 3.18 0 0.8 0.4958 1.02 0 3];
%extraer datos-----------------------------------------------
PG=D(:,2); %potencia activa generada
3 4
QG=D(:,3); %potencia reactiva generada
PC=D(:,4); %Potencia activa consuminda
QC=D(:,5); %potecia reactiva consumida
V=D(:,6); %tensión de barra
ang=D(:,7); %ángulo de barra
%datos de línea---------------------------------------------- Barra Pg(p.u) Qg(p.u.) Pd(p.u) Qd(p.u) Tensión(p.u) Angulo(°) Tipo
L=[1 2 0.01008+j*0.05040 0.05125; 1 - - 0.5 0.3099 1 0 Slack
1 3 0.00744+j*0.03720 0.03875;
2 4 0.00744+j*0.03720 0.03875; 2 0 0 1.7 1.0535 - - Carga
3 4 0.01272+j*0.06360 0.06375]; 3 0 0 2.0 1.2394 - - Carga
%nodos de conexión------------------------------------------
de=L(:,1); 4 3.18 - 0.8 0.4958 1.02 - Generador
aa=L(:,2);
Va=0;%tensión inicial de comparación del error Línea Nodos X(p.u) R(p.u) Ysh/2 (p.u)
K>> de L1 1–2 0.01008 0.05040 0.05125
de =
L2 1–3 0.00744 0.03720 0.03875
1 L3 2–4 0.00744 0.03720 0.03875
1
2 L4 3–4 0.01272 0.06360 0.06375
3
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
Matriz de admitancías
𝑖𝑗 1
𝐵𝑐 =
𝑋𝑖𝑖
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
SJ11 SJ22
%matriz Jacobiana H L
cp=0; %cte barra carga
cq=0; %cte barra carga DPQ 𝜕𝑃2 𝜕𝑃2 𝜕𝑃2 𝜕𝑃2 𝜕𝑃2
cg=0;
for k=1:length(D(:,1)) %longitud:4 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝜕𝑉2 𝜕𝑉3
if D(k,8)==1 %slack 𝜕𝑃3 𝜕𝑃3 𝜕𝑃3 𝜕𝑃3 𝜕𝑃3
sl=k;
elseif D(k,8)==2 %PQ ∆𝑃2 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝜕 𝑉 2 𝜕 𝑉 3 ∆𝛿2
cp=cp+1; ∆𝑃3 ∆𝛿3
cq=cq+1; 𝜕𝑃4 𝜕𝑃4 𝜕𝑃4 𝜕𝑃4 𝜕𝑃4
dp(cp)=k; ∆𝑃4 = . ∆𝛿4
dq(cq)=k;
∆𝑄2 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝜕𝑉2 𝜕𝑉3
elseif D(k,8)==3 %generación
∆𝑉2
cp=cp+1; ∆𝑄3 𝜕𝑄2 𝜕𝑄2 𝜕𝑄2 𝜕𝑄2 𝜕𝑄2 ∆𝑉3
cg=cg+1;
dp(cp)=k;
𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝜕𝑉2 𝜕𝑉3
dg(cg)=k; 𝜕𝑄3 𝜕𝑄3 𝜕𝑄3 𝜕𝑄3 𝜕𝑄3
end
end 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝜕𝑉2 𝜕𝑉3
J=zeros(cp+cq);%matriz jacobiana inicial----------------------------
mg=[dp dq];%subindice de columna de la matiz jacobiana--------------
SJ33 M V SJ44
DV=[ang(dp);V(dq)];%matriz de tensiones inicial---------------------
K>> J K>> DV
mg = [2 3 4 2 3]
J = DV =
0
0
0
0
0
0
0
0
0
0 0 ∆𝑃𝑖 = (𝑃𝑖𝐺𝑒𝑛 − 𝑃𝑖𝐶𝑜𝑛 ) − 𝑃𝑖𝑐𝑎𝑙
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 1 ∆𝑄𝑖 = (𝑄𝑖𝐺𝑒𝑛 −𝑄𝑖𝐶𝑜𝑛 ) − 𝑄𝑖𝑐𝑎𝑙
1
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
for pk=1:20
J=zeros(cp+cq);
SJ11=0;
SJ22=0;
SJ33=0;
SJ44=0;
SP=0;
for i=1:length(J(:,1))% filas
for p=1:length(J(:,1)) %columnas
%matriz 1
if p<=length(dp) & i<=length(dp)
if mg(i)==mg(p)
for k=1:length(D(:,1)) %para cada una de las barras
if mg(i)~=k %mg = [2 3 4 2 3]
SJ11=SJ11+abs(V(mg(i)))*abs(V(k))*abs(Ybus(mg(i),k))*sin(angle(Ybus(mg(i),k))-ang(mg(i))+ang(k));
SP=SP+abs(V(mg(i)))*abs(V(k))*abs(Ybus(mg(i),k))*cos(angle(Ybus(mg(i),k))-ang(mg(i))+ang(k));
end
end
J(i,p)=SJ11;
PQcal(i)=SP+abs(V(mg(i)))^2*real(Ybus(mg(i),mg(p)));
%Pi = Vm(n)^2*Ym(n,n)*cos(t(n,n))+J33;
DPQ(i,1)=PG(mg(i))-PC(mg(i))-PQcal(i);
SJ11=0;
SP=0;
else
J(i,p)=-abs(V(mg(i)))*abs(V(mg(p)))*abs(Ybus(mg(i),mg(p)))*sin(angle(Ybus(mg(i),mg(p)))-ang(mg(i))+ang(mg(p)));
end
𝑛 𝑛
𝜕𝑃𝑖 𝜕𝑃2 𝜕𝑃2 𝜕𝑃2
= 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . sin 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝑃𝑖𝑐𝑎𝑙 = 𝑉 2𝑖 . 𝐺𝑖𝑖 + 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . cos 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘
𝜕𝛿𝑖
𝑘=1 𝜕𝑃3 𝑘=1
𝜕𝑃3 𝜕𝑃3
𝜕𝑃𝑖 𝐻=
= − 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . sin 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 ∆𝑃𝑖 = (𝑃𝑖𝐺𝑒𝑛 − 𝑃𝑖𝐶𝑜𝑛 ) − 𝑃𝑖𝑐𝑎𝑙
𝜕𝛿𝑘
𝜕𝑃4 𝜕𝑃4 𝜕𝑃4
𝜕𝛿2 𝜕𝛿3 𝜕𝛿4
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%matriz 2
elseif p>length(dp) & i<=length(dp)
if mg(i)==mg(p)
for k=1:length(D(:,1))
if mg(i)~=k
SJ22=SJ22+abs(V(k))*abs(Ybus(mg(i),k))*cos(angle(Ybus(mg(i),k))-ang(mg(i))+ang(k));
end
end
J(i,p)=SJ22+2*abs(V(mg(i)))*real(Ybus(mg(i),mg(p)));
SJ22=0;
else
J(i,p)=abs(V(mg(i)))*abs(Ybus(mg(i),mg(p)))*cos(angle(Ybus(mg(i),mg(p)))-ang(mg(i))+ang(mg(p)));
end
𝑛
𝜕𝑃𝑖
= 2. 𝑉𝑖 . 𝐺𝑖𝑖 + 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . 𝑐𝑜𝑠 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝑃2 𝜕𝑃2
𝜕𝑉𝑖
𝑘=1
𝜕𝑉2 𝜕𝑉3
𝜕𝑃𝑖 𝜕𝑃3 𝜕𝑃3
= 𝑉𝑖 . 𝑌𝑖𝑘𝑏𝑢𝑠 . 𝑐𝑜𝑠 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝐿=
𝜕𝑉𝑘 𝜕𝑉2 𝜕𝑉3
𝜕𝑃4 𝜕𝑃4
𝜕𝑉2 𝜕𝑉3
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
𝑛 𝑛
𝜕𝑄𝑖
= 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . cos 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝑄2 𝜕𝑄2 𝜕𝑄2 𝑄𝑖𝑐𝑎𝑙 = 𝑉 2
𝑖 . 𝐵𝑖𝑖 − 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . sin 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘
𝜕𝛿𝑖
𝑘=1 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 𝑘=1
𝑀=
𝜕𝑄𝑖 𝜕𝑄3 𝜕𝑄3 𝜕𝑄3
= − 𝑉𝑖 . 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . cos 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝛿2 𝜕𝛿3 𝜕𝛿4 ∆𝑄𝑖 = (𝑄𝑖𝐺𝑒𝑛 −𝑄𝑖𝐶𝑜𝑛 ) − 𝑄𝑖𝑐𝑎𝑙
𝜕𝛿𝑘
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
%matriz 4
elseif p>length(dp) & i>length(dp)
if mg(i)==mg(p)
for k=1:length(D(:,1))
if mg(i)~=k
SJ44=SJ44+abs(V(k))*abs(Ybus(mg(i),k))*sin(angle(Ybus(mg(i),k))-ang(mg(i))+ang(k));
end
end
J(i,p)=-SJ44-2*abs(V(mg(i)))*imag(Ybus(mg(i),mg(p)));
SJ44=0;
else
J(i,p)=-abs(V(mg(i)))*abs(Ybus(mg(i),mg(p)))*sin(angle(Ybus(mg(i),mg(p)))-ang(mg(i))+ang(mg(p)));
end
end
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
end
end
𝑛
𝜕𝑄𝑖
= −2. 𝑉𝑖 . 𝐵𝑖𝑖 + 𝑉𝑘 . 𝑌𝑖𝑘𝑏𝑢𝑠 . 𝑠𝑖𝑛 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝜕𝑃2 𝜕𝑃2
𝜕𝑉𝑖
𝑘=1
𝜕𝑉2 𝜕𝑉3
𝜕𝑄𝑖 𝜕𝑃3 𝜕𝑃3
= − 𝑉𝑖 . 𝑌𝑖𝑘𝑏𝑢𝑠 . 𝑠𝑖𝑛 𝜃𝑖𝑘 − 𝜕𝑖 + 𝜕𝑘 , 𝑖 ≠ 𝑘 𝑉=
𝜕𝑉𝑘 𝜕𝑉2 𝜕𝑉3
𝜕𝑃4 𝜕𝑃4
𝜕𝑉2 𝜕𝑉3
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
VT=inv(J)*DPQ;
DV=DV+VT;
VNa(dp,1)=cos(DV(1:length(dp)))+j*sin(DV(1:length(dp)));
VNa(sl,1)=cos(ang(sl))+j*sin(ang(sl));
VNV(dq,1)=abs(DV(length(dp)+1:end));
VNV(sl,1)=abs(V(sl));
VNV(dg,1)=abs(V(dg));
V=VNV.*VNa;
ang=angle(V);
if abs(V-Va)<0.0001
break;
else
Va=V;
cumple con la tolerancia??
end
end
1. Fundamentos del lenguaje: Flujo de potencia por el método newton Rapshon
tension = angulo =
Aplicación: Flujo de potencia método de Newton Rapshon
1.0000 0
0.9824 -0.9761
%flujo de potencia---------------------------------------------------------
0.9690 -1.8722
cont=1;
1.0200 1.5231
for k=1:length(D(:,1))
for p=1:length(L(:,1)) jacobiano =
if k~=p
I(k) =(V(k) - V(p))*Y(k,p)/10 + j*Bc(k,p)*V(k)/10; 44.3270 0 -25.6508 7.0969 0
S(k,p)=V(k)*conj(I(k))*100; 0 39.6096 -14.7398 0 5.8755
P(cont,:)=[k p real(S(k,p))]; -26.1026 -15.0938 41.1963 -4.1183 -2.1655
Q(cont,:)=[k p imag(S(k,p))]; -10.3721 0 6.3048 42.9755 0
cont=cont+1; 0 -9.6932 3.8683 0 38.3186
end
end Pkp = Qkp =
PT(k,:)=[k sum(real(S(k,:)))];
QT(k,:)=[k sum(imag(S(k,:)))]; 1.0000 2.0000 38.6915 1.0000 2.0000 22.2985
end 1.0000 3.0000 98.1175 1.0000 3.0000 61.2124
1.0000 4.0000 0 1.0000 4.0000 0
%-------------------------------------------------------------------------- 2.0000 1.0000 -38.4648 2.0000 1.0000 -31.2363
jacobiano=J 2.0000 3.0000 0 2.0000 3.0000 0
tension=abs(V) 2.0000 4.0000 -131.5352 2.0000 4.0000 -74.1137
angulo=ang*180/pi 3.0000 1.0000 -97.0861 3.0000 1.0000 -63.5687
Pkp=P 3.0000 2.0000 0 3.0000 2.0000 0
Qkp=Q 3.0000 4.0000 -102.9139 3.0000 4.0000 -60.3713
Ptotal=PT 4.0000 1.0000 0 4.0000 1.0000 0
Qtotal=QT 4.0000 2.0000 133.2507 4.0000 2.0000 74.9196
4.0000 3.0000 104.7493 4.0000 3.0000 56.9301
Ptotal = Qtotal =
¿Preguntas?