Unable to perform assignment because the left and right sides have a different number of elements. Kindly Help...Many thanks!
조회 수: 5 (최근 30일)
이전 댓글 표시
I am working on a large data set(8760hrs)from an excel file:
SolRad=RaWD(:,2); WSpd =RaWD(:,3);...Grid =RaWD(:,6); etc.
I prepared the following program (extracts), but when running I got the above error:
Ppv = ones(1,8760);
for t=1:8760
Ppv(t)=epv*K(1)*SolRad(t); % power supplied by PV panels [kW]
end
Cpv=ipv*K(1);
Pw = ones(1,8760);
for t=1:8760
Pw(t)=0.5*Cp*rho*effw*K(2)*(WSpdon(t)^3); % Rated power of wind generator [kW]
end
Cw=iw*K(2);
Pg(t)= Ppv(t)+Pw(t)+Pgrid +PH(t);
SOC =ones(1,t); % Preallocation for speed
DPS = ones(1,t); % Preallocation for speed
EPG = ones(1,t);
if Pg(t)>=Pl(t)/effI % excess energy stored in the battery
SOC(t)=(SOC(t-1)*(1-dh))+((Pg(t)-(Pl(t)/effI))*ebc);
DPS(t)=0;
if SOC(t)>=SOCmax
SOC(t)=SOCmax;
EPG(t)=Pg(t)-((Pl(t)/effI)+(((SOCmax-SOC(t-1)))/ebc));
end
댓글 수: 5
Guillaume
2018년 9월 12일
Please give us the full text of the error message. Everything in red.
Unrelated to the error: None of the loops in the code you show are necessary. The first 4 lines you show can be replaced by:
PPV = epv*K(1)*SolRad; %no loop needed
assuming that SolRad is a 8760 element vector and epv is scalar. Similarly, the 2nd loop can be replaced by
Pw = 0.5*Cp*rho*effw*K(2)*Wspdon.^3; %note that .^ is required instead of ^
In addition the code after the second looks like it should have been in another loop. That loop would be more difficult to remove.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!