I am using Matlab and I am trying to find the ifft of a symmetric function but I keep getting a complex result. I have tried using circshift but I can't seem to get it figured out. I was wondering if anyone could help? Here is the code:
t=0:0.001:0.119;
for i=1:120
comp1(i)=9.8*cos(2*pi*200*t(i));
comp2(i)=7.6*cos(2*pi*145*t(i)+30/57.3);
comp3(i)=5.4*cos(2*pi*93*t(i)+70/57.3);
comp4(i)=3.2*cos(2*pi*58*t(i)+160/57.3);
comp5(i)=cos(2*pi*35*t(i)+320/57.3);
YS=comp1+comp2+comp3+comp4+comp5;
end
Q=1000/(2*60)*[-59:1:60];
Box=[zeros(1,40),ones(1,5),zeros(1,30),ones(1,5),zeros(1,40)];
Box1=circshift(Box,[0,60]);
F=ifft(Box1);
Thanks in advance for any help!
YS
andQ
in your example? they are not used in the expression forBox
– Itamar Katzfft
is padding your vector such that it is getting a length of2^n
. Then note thatifft([1,0,0,1])
does not output a real result. – flawrfft
does not do zero-padding unless you tell it to. – Itamar Katz