histogram showing x-axes as hour 0:23 and y-axes for matrix 24x45x65

1 view (last 30 days)
Hi guys.
I have a matrix M = 24x45x65 -> hour x days x customers
I want to plot a hist. where i want the data of the matrix in y-axis and time [0:23] in x-axis.
I've tried a lot without succes.
the code i've used:
hist(0:23,x_weekday(:,:,1)) %for 1 customer of 45 days and 24 hour
Help plz.

Answers (1)

Walter Roberson
Walter Roberson on 22 Apr 2014
You do not want that. Your matrix contains usage values. The y axis in histograms is counts of something. What are you counting? Number of days? That's a constant. Number of customers is a constant to.
If you want to count usage then what are you wanting, the total usage (over the 45 days) for the customer, divided up according to the hour of use? If so then you need to histogram on a sum()
Are you wanting to do only one customer at a time? Probably not. Are you wanting the histogram to reflect total load for each hour slot, totaled over all days and all customers? If so then you need two sum() calls but Yes you could use hist.
I suspect that you more likely want a 2D histogram such as at http://www.mathworks.com/matlabcentral/fileexchange/9896-2d-histogram-calculation/content/hist2.m -- or what I really suspect is that you want something closer to a waterfall plot

Categories

Find more on Formatting and Annotation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!