Draw a graph by selecting relevant information

I want to draw a distribution graph.
The issue is i need to select the values from a huge set of data.
eg; x= time Difference(1s,2s), y=frequency(1s-->No's , 2s --> No's)
Portion of the values which i need to get extracted:
time Difference =
0.1002
0.0992
0.1001
0.1003
0.0992
0.1002
0.0992
0.1002
0.1002
0.0992
0.1003
0.1002
0.0992
0.1002
.
.
.
How to select the relevant data and plot the graph?

 Réponse acceptée

Stephen23
Stephen23 le 23 Jan 2015

0 votes

Maybe histogram (or hist for older versions) does what you want.
But actually your description is not clear: please explain what you mean by "time Difference(1s,2s)". You have not really told us the conditions by which you need to select the data.

4 commentaires

Thanks for your reply Stephen.
Let me elaborate it further.
In fact time difference(as shown above- kindly look at the qu) is not going to be exactly 1s.
what i want to plot is(time(x axis), frequency(y axis) shown below:
time frequency
1st set: 0.0000 (sec) -->0.1000(sec) = how many packets
2nd set: 0.1001 (sec) -->0.2000 (sec) = how many packets
Packets can be counted by simply looking at the time difference column. suppose the time difference is 0.0999, then it goes to the 1st set(which i mentioned above)
Hope this explanation is better.
Yes, Stephen. I need to plot a histogram once i get my data accordingly.
This is what i have
timeD =
0.1002
0.0992
0.1001
0.1003
What i want is:
checkA=(0.1002>=timeD>=0.1001)
The answer should be:
1
0
1
0
Unfortunately, i am not getting the right answer. Any suggestions to improve this line.
Stephen23
Stephen23 le 25 Jan 2015
Modifié(e) : Stephen23 le 25 Jan 2015
MATLAB is great for this kind of problem, because what you wrote in your explanation is almost the right syntax for the MATLAB code. The only thing to keep in mind is that you cannot perform two logical comparisons simultaneously: A<X<B has to performed as two operations A<X & X<B. So to get your desired output try something like this:
chkA = 0.1001<=timeD & timeD<=0.1002;
I also seriously recoomand that you look at using histc ( or histcounts for newer versions), which given a vector of bin edges counts all of the values in each bin for you!
Chathu
Chathu le 26 Jan 2015
Stephen- thank you so much for your response.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by