Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Calculating cumulative frequency using awk Post 302742079 by ida1215 on Monday 10th of December 2012 01:54:51 PM
Old 12-10-2012
Hi again, Thanks much for the explanation on perl syntax. Anyway, This is the sample output am getting when I run the perl script. the columns correspond to the obs, frequency and cumulative frequency, respectively. the first value in 3rd column should be in the first row so that the last row would be equal to 1. Thanks again for looking into this.

Code:
 14.6826892861   0.0333333
 13.1351571538   0.0333333       0.0333333
 13.7802422086   0.0333333       0.0666666
 13.5688246806   0.0333333       0.0999999
 15.0765921598   0.0333333       0.1333332
 13.5727983428   0.0333333       0.1666665
 13.6297192026   0.0333333       0.1999998
 15.8496069483   0.0333333       0.2333331
 12.0589998927   0.0333333       0.2666664
 16.3124475586   0.0333333       0.2999997
 15.1092044636   0.0333333       0.333333
 16.3960654816   0.0333333       0.3666663
 14.3450835037   0.0333333       0.3999996
 14.9916008481   0.0333333       0.4333329
 15.6877187161   0.0333333       0.4666662
 13.2263422247   0.0333333       0.4999995
 16.241350749     0.0333333       0.5333328
 15.2386372531   0.0333333       0.5666661
 15.494540553     0.0333333       0.5999994
 16.0025388812   0.0333333       0.6333327
 13.8140452599   0.0333333       0.666666
 14.7094971241   0.0333333       0.6999993
 14.3596550983   0.0333333       0.7333326
 14.5479239223   0.0333333       0.7666659
 15.1549626225   0.0333333       0.7999992
 14.7984092946   0.0333333       0.8333325
 15.1006025684   0.0333333       0.8666658
 16.2515280804   0.0333333       0.8999991
 13.6803490414   0.0333333       0.9333324
 14.9813933073   0.0333333       0.9666657

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK script: decrypt text uses frequency analysis

Ez all! I have a question how to decrypt text uses letter frequency analysis. I have code which count the letters, but what i need to do after that. Can anybody help me to write a code. VERY NEEDED! My code now: #!/usr/bin/awk -f BEGIN { FS="" } { for (i=1; i <= NF; i++) { if ($i... (4 Replies)
Discussion started by: SerJel
4 Replies

2. Shell Programming and Scripting

Calculating cumulative frequency

Hi, I have a file containing the frequency's of an element sorted in ascending order. The file looks something like this: #Element Frequency 1 1 2 1 3 1 4 1 5 1 6 ... (5 Replies)
Discussion started by: sajal.bhatia
5 Replies

3. Shell Programming and Scripting

word frequency counter - awk solution?

Dear all, i need your help on this. There is a text file, i need to count word frequency for each word with frequency >40 in each line of file and output it into another file with columns like this: word1,word2,word3, ...wordn 0,0,1 1,2,0 3,2,0 etc -- each raw represents... (13 Replies)
Discussion started by: irrevocabile
13 Replies

4. Shell Programming and Scripting

Help with calculating frequency of specific word in a string

Input file: #read_1 AWEAWQQRZZZQWQQWZ #read_2 ZZAQWRQTWQQQWADSADZZZ #read_3 POGZZZZZZADWRR . . Desired output file: #read_1 3 #read_1 1 #read_2 2 #read_2 3 #read_3 6 . . (3 Replies)
Discussion started by: perl_beginner
3 Replies

5. Shell Programming and Scripting

Calculating an integer with awk

I would like to extract a number from $0 and calculate if it can be devided by 25. Though the number can also be less then 25 or bigger than 100. How do i extract the number and how can the integer be calculated? String: "all_results">39</span>I am looking for the number between "all_results"> ... (5 Replies)
Discussion started by: sdf
5 Replies

6. Shell Programming and Scripting

Calculating frequency of values within bins

Hi, I am working with files containing 2 columns in which i need to come up with the frequency/count of values in col. 2 falling within specifics binned values of col. 1. the contents of a sample file is shown below: 15 12.5 15 11.2 16 0.2 16 1.4 17 1.6 18 4.5 17 5.6 12 8.6 11 7.2 9 ... (13 Replies)
Discussion started by: ida1215
13 Replies

7. Shell Programming and Scripting

AWK way of calculating growth

Hi All, IS there any 'awk' way to manipulate following data? Fruit Date Count Apple 20/08/2011 5 Apple 27/08/2011 7 Apple 05/09/2011 11 Apple 12/09/2011 3 Apple 19/09/2011 25 . . . . Orange 20/08/2011 9 Orange 27/08/2011 20 Orange 27/08/2011 7 Orange 05/09/2011 15 Orange... (3 Replies)
Discussion started by: aniketdixit
3 Replies

8. Shell Programming and Scripting

Calculating the epoch time from standard time using awk and calculating the duration

Hi All, I have the following time stamp data in 2 columns Date TimeStamp(also with milliseconds) 05/23/2012 08:30:11.250 05/23/2012 08:30:15.500 05/23/2012 08:31.15.500 . . etc From this data I need the following output. 0.00( row1-row1 in seconds) 04.25( row2-row1 in... (5 Replies)
Discussion started by: ks_reddy
5 Replies

9. Shell Programming and Scripting

Calculating average with awk

I need to find the average from a file like: data => BW:123 M:30 RTD:0 1 0 1 0 0 1 1 1 1 0 0 1 1 0' data => BW:123 N:30 RTD:0 1 0 1 0 0 1 1 1 1 0 0 1 1 0' data => BW:123 N:30 RTD:0 1 0 1 0 0 1 1 1 1 0 0 1 1 0' data => BW:123 N:30 RTD:0 1 0 1 0 0 1 1 1 1 0 0 1 1 0' data => BW:123 N:30 RTD:0 1... (4 Replies)
Discussion started by: Slagle
4 Replies

10. Shell Programming and Scripting

awk or Bash: Cumulative average

For the data I would like to parse down and for each parsing I want a cumulative averaging, stored in an array that can be output. I.e. 546/NR = 546 (546+344)/NR=(546+344)/2 = etc. For N record input I want N values of the average (a block averaging effectively) Any... (3 Replies)
Discussion started by: chrisjorg
3 Replies
mlib_SignalMelCepstral_S16_Adp(3MLIB)			    mediaLib Library Functions			     mlib_SignalMelCepstral_S16_Adp(3MLIB)

NAME
mlib_SignalMelCepstral_S16_Adp - perform cepstral analysis in mel frequency scale SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_SignalMelCepstral_S16_Adp(mlib_s16 *cepst, mlib_s32 *cscale, const mlib_s16 *signal, void *state); DESCRIPTION
The mlib_SignalMelCepstral_S16_Adp() function performs cepstral analysis in mel frequency scale. The scaling factor of the output data will be calculated based on the actual data. The first two steps of mel scale cepstral analysis is the same as in general cepstral anaysis. After the logarithm of the spectrum magni- tude is obtained, it is converted into mel frequency scale before the inverse Fourier transform. +-----------+ +-----------+ | Linear | | Inverse | ... ------>| to |------->| Fourier |-----> X'(k) | Mel Scale | X''(m) | Transform | c(n) +-----------+ +-----------+ where X'(k) is defined in linear frequency scale and X''(m) is defined in mel frequency scale. The mel frequency scale is defined as following. freq_mel = melmul * LOG10(1 + freq_linear / meldiv) where freq_mel is the frequency in mel scale, freq_linear is the frequency in linear scale, melmul is the multiplying factor, muldiv is the dividing factor. Optionally, a bank of band pass filters in linear frequency scale can be used below the bank of band pass filters in mel frequency scale, as shown below in linear frequency scale. 0 f1 f2 f3 fp fp+1 fp+2 fp+3 fp+q |---|---|---| ... |---|----|-----| ... | ... -> freq where fp = melbgn, fp+q = melend, p = nlinear, q = nmel; the filters number 1 to p are defined in linear frequency scale which have equal bandwidth in linear frequency scale; the filters number p+1 to p+q are defined in mel frequency scale which have equal bandwidth in mel frequency scale and increasing bandwidth in linear frequency scale. See Digital Signal Processing by Alan V. Oppenheim and Ronald W. Schafer, Prentice Hall, 1974. See Fundamentals of Speech Recognition by Lawrence Rabiner and Biing-Hwang Juang, Prentice Hall, 1993. PARAMETERS
The function takes the following arguments: cepst The cepstral coefficients. cscale The scaling factor of cepstral coefficients, where actual_data = output_data * 2**(-scaling_factor). signal The input signal vector, the signal samples are in Q15 format. state Pointer to the internal state structure. RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_SignalMelCepstralInit_S16(3MLIB), mlib_SignalMelCepstral_S16(3MLIB), mlib_SignalMelCepstralFree_S16(3MLIB), attributes(5) SunOS 5.11 2 Mar 2007 mlib_SignalMelCepstral_S16_Adp(3MLIB)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy