how can i solve this problem?

1 回表示 (過去 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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by