필터 지우기
필터 지우기

comparing element of matrix

조회 수: 1 (최근 30일)
Mariam Gasra
Mariam Gasra 2019년 3월 29일
댓글: Jan 2019년 5월 3일
clc;
unit=input('input the number of unit:');
D=input('input total load :'); dP=D;
Bdat1=input('transmission losses considered matrix:');
B=Bdat1;
dB=diag(B);
data1=input('input the data:n a b c min max');
DA=array2table(data1,'V',{'Unit' 'a' 'b' 'c' 'Pl' 'Ph'});
x=max(DA.b);
n=input('insert number of iteration:')
for i=1:n
while abs(dP)>0.00001
P=(x-DA.b)./(2*(DA.c+x*dB));
P=min(P,DA.Ph); P=max(P,DA.Pl);
dP=D+P'*B*P-sum(P);
x=x+dP*2/(sum(1./DA.c));
end
end
P((P> DA.Pl) | (P < DA.Ph)) = 0;
C=DA.a+DA.b.*P+DA.c.*P.*P;
totalCost=sum(C);
display(totalCost);
lamda=x; display(lamda);
Loss=P'*B*P; display(Loss);
display(P);
display(C);
%% Economic load dispatch of Real power
% D is total Load
% dP is change during iterations
% B is loss coefficients matrix
% dB is loss vector
% DA is data of units a Table
% x is lambda,
% P is Real Power vector of all units
% C is cost of production individual units
% totalCost for all units
% Loss in transmission
% Pl Ph are min and max Constraints
input the number of unit:3
input total load :850
transmission losses considered matrix:[0.00003 0 0;0 0.00009 0;0 0 0.00012]
input the data:n a b c min max[1 605 7.92 0.001562 500 600;2 310 7.850 0.00194 100 400;3 78 7.97 0.00482 50 300]
insert number of iteration:1
if i run the programme i get all value of P =0
but i want if :P less than min or greater than max then only this element should be =zero and other P dosent change
  댓글 수: 1
Jan
Jan 2019년 5월 3일
This is not clear yet: "if :P less than min or greater than max then only this element should be =zero and other P dosent change"? What does it mean?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by