Creating a Weekly Average of Power Demand Data

2 Ansichten (letzte 30 Tage)
Cameron
Cameron am 13 Nov. 2013
Kommentiert: dpb am 13 Nov. 2013
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 Kommentar
dpb
dpb am 13 Nov. 2013
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...

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by