Skip to content

Instantly share code, notes, and snippets.

@nazarovsky
Created April 16, 2021 11:35
Show Gist options
  • Save nazarovsky/98a6b43b9ff241f9d9cbd2974a1a3fbd to your computer and use it in GitHub Desktop.
Save nazarovsky/98a6b43b9ff241f9d9cbd2974a1a3fbd to your computer and use it in GitHub Desktop.
Matlab script to read Electricity Transformer Dataset (ETDataset) https://github.com/zhouhaoyi/ETDataset
% script to read https://github.com/zhouhaoyi/ETDataset
clear all; clc;
fileName = 'ETTm1.csv';
fileID = fopen(fileName);
C = textscan(fileID,'%s %f %f %f %f %f %f %f %f %f', 'HeaderLines',1, 'Delimiter',',');
fclose(fileID);
A = cell2mat(C(:,2:7));
T = datetime(cell2mat(C{1}) , 'InputFormat','yyyy-MM-dd HH:mm:ss');
OT = cell2mat(C(:,8));
HUFL = A(:,1);
HULL = A(:,2);
MUFL = A(:,3);
MULL = A(:,4);
LUFL = A(:,5);
LULL = A(:,6);
S1 = sqrt(HUFL.^2+HULL.^2);
COS1 = cos(atan2( HULL , HUFL));
S2 = sqrt(MUFL.^2+MULL.^2);
COS2 = cos(atan2( MULL , MUFL));
S3 = sqrt(LUFL.^2+LULL.^2);
COS3 = cos(atan2( LULL , LUFL));
figure;
plot(T,HUFL); hold on; plot(T,MUFL); plot(T,LUFL);
legend('HIGH','MED','LOW');
title('ACTIVE ENERGY');
figure;
plot(T,HULL); hold on; plot(T,MULL); plot(T,LULL);
legend('HIGH','MED','LOW');
title('REACTIVE ENERGY');
figure;
subplot(1,2,1);
plot(T,S1); hold on;plot(T,S2);plot(T,S3);
legend('HIGH','MED','LOW');
title('APPARENT ENERGY');
subplot(1,2,2);
plot(T,COS1); hold on; plot(T,COS2); plot(T,COS3);
legend('HIGH','MED','LOW');
title('COS PHI');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment