error to get a result
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clear
clc
%Defining Variables
unit=input('input the number of unit:');
D=input('input total load :'); dP=D;
n=input('insert number of iteration:');
for i=1:unit
a(i)=input('constant=');
b(i)=input('coff P');
c(i)=input('coff P^2');
B(i)=input('losses');
min(i)=input('main');
max(i)=input('max');
end
dB=diag(B);
x=max(b);
for i=1:n
while abs(dP)>0.00001
for i=1:unit
P(i)=(x-b(i))./(2*(c(i)+x*dB));
end
P=min(min(i)); P=max(max(i));
dP=D+P'*los(i)*P-sum(P);
x=x+dP*2/(sum(1./c(i)));
end
end
for i=1:unit
C(i)=a(i)+b(i).*P+c(i).*P.*P;
end
totalCost=sum(C);
display(totalCost);
lamda=x; display(lamda);
Loss=P'*B*P; display(Loss);
display(P);
display(C);
unit=3
D=850
n=1
constanat= 605 and 310 and 78
coff P= 7.92 and 7.85 and 7.97
coff P^2= 0.001562 and 0.00194 and 0.00482
B= 0.00003 and 0.00009 0.00012
min=100 and 100 and 50
max= 600 and 400 and 300
I would fix errors in this code
1 Kommentar
Jan
am 3 Mai 2019
If you mention, that you want to fix an error, be so kind and explain, what the error is. Do you get an error message, then post a complete copy of it. Or does the result differ from your expectations? Then explain both, the result and your expectations.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!