How do I adjust my histogram to show approx. 50 different categorized bins with very small data?

1 view (last 30 days)
I am trying to produce a histogram that shows bins like this one:
Here is my script:
-------------------
iter=10000;
FS=40;
for n=1:iter
Sy=2.11*10^8+(60*rand(1));
w=0.0077629+(0.0004*rand(1));
F=30.4+(2*rand(1));
t=(FS*F)/(Sy*w)
end
histogram(t,1000)
-----------
The iterations are displayed just fine and are all between 0.0007 and 0.0008 as expected for 't'. When the histogram is displayed there is just one solid block with a bin range from 0 to 0.5 and a y-value of 1.

Accepted Answer

Star Strider
Star Strider on 23 Mar 2019
You need to subscript ‘t’ to save it as a vector.
Try this:
iter=10000;
FS=40;
for n=1:iter
Sy=2.11*10^8+(60*rand(1));
w=0.0077629+(0.0004*rand(1));
F=30.4+(2*rand(1));
t(n)=(FS*F)/(Sy*w);
end
histogram(t,1000)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!