how can i solve this problem?
    16 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
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;
0 Kommentare
Antworten (1)
  Spencer Chen
      
 am 3 Feb. 2020
        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
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

