Creating a Weekly Average of Power Demand Data
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I am working on a script that takes hourly power demand loading data. I currently import the system total data into "dataB" vector. I am looking at creating a plot for the average week of the system for analysis. With this I am trying to create a new vector ("Sum") to list the average value for each of the 168 hours in a week. I tried to loop through dataB adding the values together, then averaging this by the 52 weeks in a year. The dataB gets imported fine, as per my import script, but the sum vector remains a 168x1 vector that contains all zeros. Please see below for the loop script I am using now. Any help would be appreciated. Thanks.
[Time,dataB,dataC,dataD,dataE,dataF,dataG] = importfile(filename);
sum = zeros(168,1);
Sys_Avg = zeros(168,1);
for i= 0:51;
for j = 1:168;
{
{
sum(j, 1) == sum(j, 1) + dataB(j+(i*j), 1);
}
}
end
end
for i = 1:168;
{
Sys_Avg(i, 1) == sum(i,1)/52;
}
end
댓글 수: 1
dpb
2013년 11월 13일
Matlab is not C -- you don't enclose clauses in for or if constructs in braces. They indicate a cell array, NOT what you're wanting here...
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!