# how is it possible to solve below matlab codes problem?

6 views (last 30 days)
i=1:8784 %one year (hours)
end
now after finding Pch and Pdis from 1 to 8784 hours, i want to write another code or loop to solve 'b' between 1:8784 , for example ;
when (Pch & Pdis)=0 %at the same time when both Pch and Pdis become zero, then
• which i mean when Pch and Pdis at the same time became zero then use b=PLoad(i,1) - Ppv_N(i,1)
thanks

David Hill on 14 Jan 2020
I was somewhat confused with your question. Hopefully, this helps:
for i=1:8784 %one year (hours)
end
end
b=[];
for i=1:8784
if Pch(1,i)==Pdis(1,i)
b=[b,PLoad(i,1) - Ppv_N(i,1)];%not sure if you will have more than one occurrance
end
end

Thank you very much for replying, sorry for my bad english ;(
i mean;
end
if Pch & Pdis <=0
if the results of Pch and Pdis will become;
Pch= [10 15 20 0 50 20 30 0 0];
Pdis=[11 18 15 0 20 35 15 0 0];
then use this ''b=PLoad(i,1) - Ppv_N(i,1)'' only when at time 4 ,8,9 that the result for both Pch and Pdis are 0.
It might be anytime between 1:8784 for example at time 500 or 5000 wherever Pch and Pdis become 0 at the same time, system must run ''b=PLoad(i,1) - Ppv_N(i,1)' .
David Hill on 15 Jan 2020
Is that not that what I did?