I've written some software (in python using numpy) that will let the user create a waveform (a numpy array of N real floating point points) from a variety of one and two parameter probability distributions.
I want to let the user band-limit the resulting waveforms if they wish. Here's how I'm doing this. I take the rfft, which is the first half of the normal fft (corresponding to positive frequencies). The user then chooses 0 < p <= 1.0 and I chop the fraction (1 - p) off the right-hand side of the rfft (i.e., set those points to zero). I take the inverse rfft to get the band-limited waveform back.
Questions:
1. Is this an acceptable method of band-limiting the signal? If not, what would you recommend?
2. Are there any numerical surprises that I might encounter?
I've done an hour or two of testing a wide variety of waveforms and this method seems to work exactly as my intuition says it should. I limit p so that it must be >= 2/N; this looks like a good low frequency cutoff because it always yields a sine wave on the things I've tested it on.
I want to let the user band-limit the resulting waveforms if they wish. Here's how I'm doing this. I take the rfft, which is the first half of the normal fft (corresponding to positive frequencies). The user then chooses 0 < p <= 1.0 and I chop the fraction (1 - p) off the right-hand side of the rfft (i.e., set those points to zero). I take the inverse rfft to get the band-limited waveform back.
Questions:
1. Is this an acceptable method of band-limiting the signal? If not, what would you recommend?
2. Are there any numerical surprises that I might encounter?
I've done an hour or two of testing a wide variety of waveforms and this method seems to work exactly as my intuition says it should. I limit p so that it must be >= 2/N; this looks like a good low frequency cutoff because it always yields a sine wave on the things I've tested it on.