how can i solve this problem?

조회 수: 2 (최근 30일)
Mamad Mamadi
Mamad Mamadi 2020년 2월 3일
댓글: Mamad Mamadi 2020년 2월 6일
helloo friends could you please help me to solve this problems.
the codes that i mentioned below are the original codes for one value. how can i solve it for 5 values?
which i mean i have these values Np=[1 5 10 20 30] and i want to solve Pch, Pdis and LLP at the same time for 5 numbers . i mean the system must put value 1 to solve
below codes then put 5 to solve below codes and after that put 10 to solve below codes and so on till 30.
Np= [1 5 10 20 30];
ToplamLoad = sum(PLoad);
syms SUM;
Pdis=[];
Pch=[];
Eksik=[];
for i=1:1:t
Ppv_N(i,1)=(Ppv(i,1))*Np;
Ppv_top=sum(Ppv_N);
if Ppv_N(i,1) > PLoad(i,1);
Fazla= Ppv_N(i,1)- PLoad(i,1);
Fazla_enerji(i,1)= double(Fazla);
Toplam_fazla_enerji = sum(Fazla_enerji);
Pch(1,i)=(Pbat*(1-sigma))+(Ppv_N(i,1)-(PLoad(i,1)/eta_i))*eta_b;
if Pch(1,i)>Pmax
Pch(1,i)=Pmax;
Pbat=Pch(1,i);
continue;
end
Pbat=Pch(1,i);
if Pch(1,i)<Pmin
Pch(1,i)=0;
continue;
end
Pbat=Pch(1,i);
if Pch(1,i)>Pmin
Eksik(1,i)=0;
continue;
end
Pbat=Pch(1,i);
else Ppv_N(i,1) < PLoad(i,1);
Pdis(1,i)=(Pbat*(1-sigma))-((PLoad(i,1)/eta_i)-(Ppv_N(i,1)));
if Pdis(1,i)<Pmin
Pdis(1,i)=0;
Pbat=Pdis(1,i);
Eksik=[Eksik,PLoad(i,1) - Ppv_N(i,1)];
TKE=sum(Eksik); %Toplam Karsilanamayan Enerji
continue;
end
Pbat=Pdis(1,i);
end
end
LLP = TKE/ToplamLoad;
T=Ppv_top/ToplamLoad;

답변 (1개)

Spencer Chen
Spencer Chen 2020년 2월 3일
Maybe this will get you started. You already have in your code an example of a for-loop. To put Np into a loop, you can construct it like this:
Np_ = [1 5 10 20 30];
for jj = 1:numel(Np_)
Np = Np_(jj);
...
end
I'll leave the rest for you figure out. One problem that you will need to figure out is to how to assign yout LLP and T values from each iteration of the loop.
If you want to read up on Matlab functions, then that will be my prefered solution.
Blessings,
Spencer
  댓글 수: 1
Mamad Mamadi
Mamad Mamadi 2020년 2월 6일
thanks for your answer :) but i didnt do it. it gives me wrong answe for first 4 valus gives me 0 ,
for example LLP= [ 0 0 0 0 1.14]

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by