fft of sin(pi*x/5)./(pi*x) returns NaN
2 views (last 30 days)
I don't know why, if I do the G=sin(pi*x/5)./(pi*x), it returns NaN, can you help me?
freq =transpose( -Fs/2:Fs/length(G):Fs/2-(Fs/length(G)));
Star Strider on 11 Jul 2019
When ‘x’ is 0, ‘G’ becomes 0/0, and the IEEE standard defines that as NaN. Any NaN in a vector will propagate through all calculations involving it to result in the entire vector being NaN.
You can get around that by creating a version of L’Hospital’s rule by addint eps to ‘x’:
Thar results in the entire vector — and its fft — being defined and not NaN.