# how can i solve this problem?

1 Ansicht (letzte 30 Tage)
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);
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);
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
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### 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
##### 1 KommentarKeine anzeigenKeine ausblenden
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]

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Loops and Conditional Statements in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by