Clear Filters
Clear Filters

how can I draw histogram of a sine wave without "hist" command and with "plot" command?

2 views (last 30 days)
I want to write a program to draw a histogram for sine wave without the "hist" command and draw its histogram with "plot" command. the number of Bins can be a constant number. or evenif I can define a function that its input are : the number of Bins and the signal varible. I don't know how , can any body help me?

Answers (1)

Walter Roberson
Walter Roberson on 9 Mar 2013
It can be done. You would need to use something like
plot( [1 1 2 2 3 3 4 4 5 5], [0 v1 v1 0 0 v2 v2 0 0 v3])
where v1, v2, v3 are the height values.
Have you considered using bar() instead of plot()

Community Treasure Hunt

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

Start Hunting!