Creating a Weekly Average of Power Demand Data

조회 수: 2 (최근 30일)
Cameron
Cameron 2013년 11월 13일
댓글: dpb 2013년 11월 13일
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
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by