Help with load profile curve _ i have half hourly (48 readings) of a single day.

10 views (last 30 days)
hi all.
what i have is 48 kwhr readings( half hourly readings) of a single day. i would like to plot it against time on x-axis, from 12AM to 12PM, in increments of 30 minutes.
X axis will be somethings like :-
12AM 12:30AM 1AM 1:30AM 2AM 2:30AM etc upto 12PM
is this possible in matlab ?
i have a dat file with counts,
so importing the data using :- [count]=importdata('C:\Users\radzzz\Documents\count.dat')
i would like to use plot(time,count) or similar to plot the graph. i made an attempt but i get bad readings on x axis and i couldnt include 30 min intervals.
i would like to feed this load profile into one of the simulink blocks so that i can get the energy cost, is this possible ? can i input matlab .m files into simulink ?
please help.
thanks.
  4 Comments
Arun Das
Arun Das on 2 Dec 2012
year = 2012 * ones(1,n);
month = 12 * ones(1,n);
day = 2 * ones(1,n);
hour = 1:n;
%i tried using 24 instead of n, but it won't plot because count is 48
minutes = zeros(1,n);
xdate = datenum(year,month,day,hour,minutes,minutes);
plot(xdate,count);
datetick('x','HHPM')
%this is an example i saw in web, modified it. Can i attach my figure with the reply ? i am new here. :)

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 2 Dec 2012
year = 2012 * ones(n*2,1);
month = 12 * ones(n*2,1);
day = 2 * ones(n*2,1);
hour = reshape([0:n-1; 0:n-1], 2*n, 1);
minutes = repmat([0;30], n, 1);
xdate = datenum(year,month,day,hour,minutes,minutes);
plot(xdate,count);
datetick('x','HH:MMPM')
  2 Comments
Arun Das
Arun Das on 2 Dec 2012
thanks for the reply sir, but i didnt got the plot. it says
??? Error using ==> plot Vectors must be the same lengths.
Error in ==> Dec_2 at 11 plot(xdate,count);
Arun Das
Arun Das on 2 Dec 2012
Edited: Arun Das on 2 Dec 2012
sir i got a plot from 12AM to 12PM in increments of 1hour when i modified my code to this _
% Get data data=xlsread('W:\final projct\SIMULINK MAIN FOLDER\essential_docs\Load_Curve\Source_LDC_H1.xlsx');
count=data(2,:)
n = length(count)
year = 2012 * ones(1,n);
month = 12 * ones(1,n);
day = 2 * ones(1,n);
hour = 0:.5:23.5
minutes = zeros(1,n);
xdate = datenum(year,month,day,hour,minutes,minutes);
plot(xdate,count)
% Update the graph's x-axis with date ticks
datetick('x','HHPM')

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!