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
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