# how can i solve this problem?

1 view (last 30 days)
Commented: Mamad Mamadi on 6 Feb 2020
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];
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_enerji(i,1)= double(Fazla);
Toplam_fazla_enerji = sum(Fazla_enerji);
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);
if Pdis(1,i)<Pmin
Pdis(1,i)=0;
Pbat=Pdis(1,i);
TKE=sum(Eksik); %Toplam Karsilanamayan Enerji
continue;
end
Pbat=Pdis(1,i);
end
end

Spencer Chen on 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

#### 1 Comment

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]