robert bristow-johnson <rbj@audioimagination.com> writes:
> On 1/11/14 10:06 AM, Randy Yates wrote:
>>
>> Well then of course they will be different. If signal vectors x1 != x2,
>> would you expect fft(x1) = fft(x2)?!?
>>
>> It is the data vector you should window, not the input to the FFT. If
>>
>> L = NFFT,
>>
>> then of course they're one and the same.
>
> sorry, Randy. didn't see you nail this until after i responded.
No problem, Robert. Sometimes I still answer again even though I see a
perfectly good answer because it may help to see a slightly different
POV and/or different words.
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
Reply by robert bristow-johnson●January 11, 20142014-01-11
On 1/11/14 10:06 AM, Randy Yates wrote:
>
> Well then of course they will be different. If signal vectors x1 != x2,
> would you expect fft(x1) = fft(x2)?!?
>
> It is the data vector you should window, not the input to the FFT. If
>
> L = NFFT,
>
> then of course they're one and the same.
sorry, Randy. didn't see you nail this until after i responded.
--
r b-j rbj@audioimagination.com
"Imagination is more important than knowledge."
Reply by robert bristow-johnson●January 11, 20142014-01-11
On 1/11/14 8:14 AM, Marc Jenkins wrote:
> On 2014-01-07 18:20:19 +0000, robert bristow-johnson said:
>
>> On 1/7/14 11:06 AM, Marc Jenkins wrote:
>>> On 2014-01-06 03:06:17 +0000, robert bristow-johnson said:
>>>
>>>> also, Marc, you can (and, in my opinion, should) think of this
>>>> windowing and zero-padding as one single operations.
>>>>
>>>> before the operation you have x[n] for -inf < n < +inf
>>>>
>>>> after the operation you have x[n] * w[n] for the same n.
>>>>
>>>> both the truncation of x[n] to a specific length and the zero padding
>>>> can be modeled as zeros in the same w[n].
>>>>
>>>> then it doesn't matter what the order is.
>>>
>>> But why is there a tremendous difference in the FFT-result when changing
>>> the order?
>>>
>>
>> make sure it's the same w[n].
>
> What do you mean with that?
only what i said.
> Consider following pseude-matlab code:
>
> % Signal is y
> L = length(y);
> window = hann(L);
> NFFT = 2^nextpow2(L);
> y = [y; zeros(NFFT-L, 1)];
here, you stretched out y and made it longer.
> S = fft(y .* window, NFFT);
but you didn't zero-pad window.
you have to do this
L = length(y);
window = hann(L);
NFFT = 2^nextpow2(L);
y = [y; zeros(NFFT-L, 1)];
window = [window; zeros(NFFT-L, 1)];
S = fft(y .* window, NFFT);
and compare to your second case:
>
> vs.
>
> % Signal is y
> L = length(y);
> window = hann(L);
> y = y .* window;
> NFFT = 2^nextpow2(L);
> y = [y; zeros(NFFT-L, 1)];
> S = fft(y, NFFT);
>
but if you compare to this:
L = length(y);
NFFT = 2^nextpow2(L);
window = hann(NFFT);
y = [y; zeros(NFFT-L, 1)];
S = fft(y .* window, NFFT);
it's not the same window.
> These two variants clearly yield different results.
how? you cannot make this test yield different results because you
cannot make the multiplication by the window of a different length work.
MATLAB should flag that as an error.
--
r b-j rbj@audioimagination.com
"Imagination is more important than knowledge."
Reply by Randy Yates●January 11, 20142014-01-11
Marc Jenkins <marc.jenkins@noreply.com> writes:
> On 2014-01-11 14:54:24 +0000, Randy Yates said:
>
>> Marc Jenkins <marc.jenkins@noreply.com> writes:
>>> [...]
>>> % Signal is y
>>> L = length(y);
>>> window = hann(L);
>>> NFFT = 2^nextpow2(L);
>>> y = [y; zeros(NFFT-L, 1)];
>>> S = fft(y .* window, NFFT);
>>
>> Unless the length of y is already a power of two, this should not even
>> run. The line
>>
>> S = fft(y .* window, NFFT);
>>
>> should bomb out since you can't take the element-by-element
>> multiplication (.*) of two vectors of different lengths.
>
>
> You're right. But consider this two examples with the following window
> for the first
> window = hann(NFFT). That was what I meant.
Well then of course they will be different. If signal vectors x1 != x2,
would you expect fft(x1) = fft(x2)?!?
It is the data vector you should window, not the input to the FFT. If
L = NFFT,
then of course they're one and the same.
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
Reply by Marc Jenkins●January 11, 20142014-01-11
On 2014-01-11 14:54:24 +0000, Randy Yates said:
> Marc Jenkins <marc.jenkins@noreply.com> writes:
>> [...]
>> % Signal is y
>> L = length(y);
>> window = hann(L);
>> NFFT = 2^nextpow2(L);
>> y = [y; zeros(NFFT-L, 1)];
>> S = fft(y .* window, NFFT);
>
> Unless the length of y is already a power of two, this should not even
> run. The line
>
> S = fft(y .* window, NFFT);
>
> should bomb out since you can't take the element-by-element
> multiplication (.*) of two vectors of different lengths.
You're right. But consider this two examples with the following window
for the first
window = hann(NFFT). That was what I meant.
Marc
Reply by Randy Yates●January 11, 20142014-01-11
Marc Jenkins <marc.jenkins@noreply.com> writes:
> [...]
> % Signal is y
> L = length(y);
> window = hann(L);
> NFFT = 2^nextpow2(L);
> y = [y; zeros(NFFT-L, 1)];
> S = fft(y .* window, NFFT);
Unless the length of y is already a power of two, this should not even
run. The line
S = fft(y .* window, NFFT);
should bomb out since you can't take the element-by-element
multiplication (.*) of two vectors of different lengths.
> vs.
>
> % Signal is y
> L = length(y);
> window = hann(L);
> y = y .* window;
> NFFT = 2^nextpow2(L);
> y = [y; zeros(NFFT-L, 1)];
> S = fft(y, NFFT);
>
> These two variants clearly yield different results.
If the length of y is already a power of two, NFFT = L and the results
should be identical.
This is assuming nextpow2(L) = ceil(log2(L)).
--
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
Reply by Marc Jenkins●January 11, 20142014-01-11
On 2014-01-07 18:20:19 +0000, robert bristow-johnson said:
> On 1/7/14 11:06 AM, Marc Jenkins wrote:
>> On 2014-01-06 03:06:17 +0000, robert bristow-johnson said:
>>
>>> also, Marc, you can (and, in my opinion, should) think of this
>>> windowing and zero-padding as one single operations.
>>>
>>> before the operation you have x[n] for -inf < n < +inf
>>>
>>> after the operation you have x[n] * w[n] for the same n.
>>>
>>> both the truncation of x[n] to a specific length and the zero padding
>>> can be modeled as zeros in the same w[n].
>>>
>>> then it doesn't matter what the order is.
>>
>> But why is there a tremendous difference in the FFT-result when changing
>> the order?
>>
>
> make sure it's the same w[n].
What do you mean with that. Consider following pseude-matlab code:
% Signal is y
L = length(y);
window = hann(L);
NFFT = 2^nextpow2(L);
y = [y; zeros(NFFT-L, 1)];
S = fft(y .* window, NFFT);
vs.
% Signal is y
L = length(y);
window = hann(L);
y = y .* window;
NFFT = 2^nextpow2(L);
y = [y; zeros(NFFT-L, 1)];
S = fft(y, NFFT);
These two variants clearly yield different results. With the first one
I get see spectrum peaks which I do not see with the second version - I
want to understand what happens here.
Marc
Reply by robert bristow-johnson●January 8, 20142014-01-08
On 1/8/14 12:00 AM, radams2000@gmail.com wrote:
> Great, for some reason I was getting errors for several days in a row (thought I was banned due to lame humor).
nobuddy gets band here, Bob. maybe humiliated but there is no mechanism
for banning in unmoderated USENET. *maybe* the NNTP servers have a way
of filtering out bot or spam posts. i don't see them very much of late,
so i imagine the NNTP servers have figured something out.
--
r b-j rbj@audioimagination.com
"Imagination is more important than knowledge."
Reply by ●January 8, 20142014-01-08
Great, for some reason I was getting errors for several days in a row (thought I was banned due to lame humor).
Bob
Reply by robert bristow-johnson●January 8, 20142014-01-08
On 1/7/14 11:52 AM, radams2000@gmail.com wrote:
> Test
i can hear you now, Bob.
--
r b-j rbj@audioimagination.com
"Imagination is more important than knowledge."