Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: How to generate 2D Frequency Matrix
Posted:
Dec 3, 2012 3:00 AM


"Roger Stafford" wrote in message <k9hjca$bro$1@newscl01ah.mathworks.com>... > "S Ehtesham Al Hanif" <ehtesham.buet@gmail.com> wrote in message <k9hhls$6gh$1@newscl01ah.mathworks.com>... > > Actually, I have data?s like below: > > A B > > 4.8 1.34 > > 9.5 1.30 > > 13.8 1.21 > > 18.5 1.30 > > 23.0 1.25 > > 27.2 1.16 > > 27.9 0.18 > > 29.1 0.36 > > 33.3 1.16 > > 34.9 0.45 > > 36.1 0.31 > > 36.2 0.04 > > 35.6 0.18 > > 34.6 0.27 > > 33.6 0.27 > > 32.8 0.22 > > 31.9 0.27 > > 27.4 1.25 > > 24.0 0.94 > > 24.0 0.00 > > > > Now I want to generate a matrix with frequency distribution like below > > A\B 1 2 0 1 2 > > 05 x x x x x > > 510 x x x x x > > 1015 x x x x x > > 1520 x x x x x > > > > These x (frequency) I have to find out and these, x will be a (mxn) matrix based on those condition. Each x will have to fulfill A(05,510 etc) & B(1,2,0, etc) matrix at a same time then when full column matrix complete then the resultant X(mxn) matrix with overall frequency. >           > I don't understand your example. For instance, which of the 20 x's does the pair (36.2 , 0.04) contribute to? Your A column values go beyond the intervals you describe and the B conditions aren't intervals. > > Roger Stafford
Hi Roger
Actually in my case, I have three column but i can avoid first one which has time value. In details: Column T has value of time as second t=1:1:1400; Column A has value of velocity/speed and it has 1400 speed values from 0(zero) to 100(hundred). In this case some velocity values repeats after uncertain interval. Column B has value of acceleration and it has 1400 acceleration/deccelaration values from 4(minus four) to +4(four). In this case some acceleration values has repetition.
Now i want to generate a mxn matrix where every position will be a frequency which can full fill one condition from A and same time one corresponding B condition.
I subdivided velocity column into several group, such as: 0 to 5, 5 to 10, 10 to 15, 15 to 20 .........90 to 95 and 95100.
Similarly i subdivided acceleration column into several group such as: 4 to 3, 3 to 2 ...... 2 to 3 and 3 to 4.
Then, i will count frequency such a way that it will full fill both columns same row with those condition.
As an example: if i look at the previous posts Column A. And Column B, then i have to find out how many times/frequency the below conditioned fullfilled?
If velocity range : 30 to 35 m/s and acceleration at the same time/row in 0.5 to 0.25 range ? According to example it has frequent/count 3! If velocity range same but acceleration condition changed to 0.25 to 0 then it has frequency 1.
I think this time my illustration is better as if it is possible to show you by showing picture or figure by attaching here it will be easy to explain what i am planning for!
Ehtesham



