Skip to content

Instantly share code, notes, and snippets.

@caiorss
Forked from weinberz/histograms.matlab
Created December 25, 2016 21:17
Show Gist options
  • Save caiorss/860c7df8f02d3b2aab97c255dd277bbb to your computer and use it in GitHub Desktop.
Save caiorss/860c7df8f02d3b2aab97c255dd277bbb to your computer and use it in GitHub Desktop.
Simple histograms in MATLAB
names = {}
x = hist(Lifetimes,[50 100 150 200 250 300 350 400])
for i = 1:size(x)
x(:,i) = x(:,i)./sum(x(:,i))
end
hist(Lifetimes,[50 100 150 200 250 300 350 400])
legend(names)
bins = [50 100 150 200 250 300 350 400];
figure()
hold all
for i=1:size(x,2)
bar((bins - i+4),x(:,i),'BarWidth',4)
end
legend(names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment