FFT returns a different amplitude value, why?
조회 수: 1 (최근 30일)
이전 댓글 표시
Dear Colleagues,
I am working in this code (attached):
t = 0:0.05:4*pi; x=2+1.5*cos((2*pi/360)*60*t+(2*p)i/360)*90) N1=length(t) n1=log2(N1) n1=ceil(n1) vet = 2^n1 %multiple of 2^n;
b = N1+1; while b~=vet+1 t(b)= (t(b-1)-t(b-2))+t(b-1) %complementing the time vector to the lentgh vet; x(b)= 0 %comlementing the vector x with zeros until lenght vet; b=b+1 end
sample_rate=1/(abs(t(2)-t(1))) f=sample_rate*((0:vet/2))/vet %vector frequency associated; n=length(f) X=fft(x) fftX=X*1/(vet) abs_fftX=abs(fftX(1:n)) figure(1) stem(f,abs_fftX)
When I compute fft and plot (stem) the result, appears 1.94 in the graphic origin (phase is zero) instead of 2. It needs to be 2 (phase is zero), because it is a DC signal from x= 2 +1.5*cos((2*pi/360)*60*t+(2*p)i/360)*90). So, maybe in the others frequencies could be wrong too. Could somebody teach me how to fix it? Thanks a lot.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 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!