Sorting into bins
- To: mathgroup at smc.vnet.net
- Subject: [mg119630] Sorting into bins
- From: Hugh Goyder <h.g.d.goyder at cranfield.ac.uk>
- Date: Wed, 15 Jun 2011 07:20:03 -0400 (EDT)
I wish to sort a list of {{x,y}...} values into uneven bins using the x values to locate the bin but have the bins contain the y values. This seems like an application for BinLists but it only seems to work on a list of x values. The motivation is to give a spectra in terms of 1/3 octaves which is a standard presentation in acoustics. Below I construct the bin center frequencies cf, the bin boundaries bb and generate a time history th, spectra, yy and corresponding frequencies xx. How do I then sort the list into my bins? Thanks Hugh Goyder cf = Table[(1/100.) Round[100 (1000/1024) 2^n], {n, 1, 15, 1/3}]; bb = Table[Sqrt[cc[[i]]*cc[[i + 1]]], {i, 1, Length[cc] - 1}]; sr = 60000.; th = Table[y, {y, 0, 1, 1/sr}]; n = Length[th]; yy = Take[ Fourier[th, FourierParameters -> {1, -1}], {1, Ceiling[n/2]}]; xx = Table[f, {f, 0, sr/2, sr/n}]; data = Transpose[{xx, yy}];
- Follow-Ups:
- Re: Sorting into bins
- From: Heike Gramberg <heike.gramberg@gmail.com>
- Re: Sorting into bins