FFT issue
1 次查看(过去 30 天)
显示 更早的评论
When I attempt a Fourier Transform of my data, v, all the values of Y are NaN + NaNi
%v(t)
t=-1.5:0.001:1.5; %time, s
B=1.5*pi; %T
f0=20; %Hz
for i=1:length(t);
v(i)=(B*sin(2*pi*f0*t(i)))/(pi*t(i));
end
plot(t,v);
max(v) %Voltage,V
min(v) %Voltage,V
%Fourier Transform
Y=fft(v)
Any clues as to why this is occurring??
Thanks guys
0 个评论
采纳的回答
Walter Roberson
2012-3-3
Your time range includes time 0, and your v(i) for time 0 is 0/0 which is NaN. Once you have a NaN in your data, it is going to "pollute" everything else when you do the fft()
更多回答(2 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!