how can i count the values above a threshold of random data and represent on a graph of time vs. rate ?

2 次查看(过去 30 天)
the # of occurrences (Rate) should be represented right in the middle of time slot. say 6 values above threshold within 0-1 second. 6 should be at .5s in the graph.
any help is appreciated thanks.
  10 个评论
Ana-Patricia Lopez
i will post a new question for a new answer since this question was already answered with what I needed. unless you prefer to answer this question here, that is fine with me.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2013-11-18
Apply histc() with evenly-distributed bins (of the desired time interval), applying it to your times. Use the two-output form of histc(), and then the second output will tell you the bin number. At that point,
counts = accumarray(bin_number(:), y(:) >= THRESHOLD);
This will give you the number of occurrences for each bin.
After that it just becomes a matter of text()'ing the counts into place at the mid-point of each interval.
  6 个评论
Ana-Patricia Lopez
Ana-Patricia Lopez 2013-11-30
thanks for your reply @image analyst - really helpfull
When I proceed and run accumarray, I get this:
Error using accumarray Second input VAL must be a vector with one element for each row in SUBS, or a scalar.
I have tried plugging in y, Y, y_values and still get the same error:
counts=accumarray(ind(:), y_values(:));
I was not able to find a clear solution on the web. any thoughts?
-thanks

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by