Normal Distribution - using 24x45x65 matrix. - How to do this?
2 views (last 30 days)
Show older comments
Hello
I have a set of data in a matrix of: 24x45x65 --> hours x days x customers i want to make a normal distribution plot for each hour of lets say 1 customer on y-axis. so there will be 24 Graphs. then i can show the mean of it..lower and upper boundry on the plot. its data of some customers using energy in different times of the day..(before going to Work and coming back from the Work) example(used pain
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161488/image.jpeg)
t :P)
is it possible to do so? i will include my data to this file..so its easier to understand :)
thanks in advance, help will be appreciated alot.
0 Comments
Accepted Answer
Star Strider
on 22 Apr 2014
Edited: Star Strider
on 22 Apr 2014
This seems to work:
load x_weekday
xwkd = x_weekday;
for k1 = 1:size(xwkd,1)
hrmx = xwkd(k1,:,:); % All data for hour ‘k1’
hrmn(k1) = mean(hrmx(:)); % Mean
hrsd(k1) = std(hrmx(:)); % Standard deviation
end
N = numel(hrmx);
figure(2) % Plot Mean ± Standard Deviation
errorbar([1:24], hrmn, hrsd)
grid
xlabel('Hour')
ylabel('kWh ± SD')
figure(3) % Plot Mean ± Standard Error
errorbar([1:24], hrmn, hrsd/sqrt(N))
grid
xlabel('Hour')
ylabel('kWh ± SE')
It plots the data for all customers. To plot data for a particular customer, say Customer #10, change this line:
hrmx = xwkd(k1,:,:); % All data for hour ‘k1’
to:
hrmx = xwkd(k1,:,10); % All data for Customer 10 for hour ‘k1’
10 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!