Why am I getting complex values in a function after IFFT function?
古いコメントを表示
I have taken a simple function (the code below) for illustration to understand my real MATLAB code. I was taught that when we do an FFT of any function (denoted by y_ft), we get the function in a frequency domain that has complex values (e.g.,:a+ib). After taking the IFFT (variable: y_ifft), I should get the function value with only real numbers (just a's). But in the below code, my y_ifft has still complex values. Why is that? Since the Fourier analysis concepts are new learning to me, I am missing some concept here. Answers are appreciable.
f0=4; % frquency of a sine wave
Fs=100; % sampling rate
dt=1/Fs; %sampling interval
t=0:dt:1-dt; % time axis
n=length(t); %number of samples
y=2*sin(2*pi*f0*t); %sine function
figure()
plot(t,y);
y_ft=fft(y);
y_ifft=ifft(y);
figure()
stem(abs(y_ft),'*');
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!