How to Normalize a fft to plot in frequency domain?
Mostrar comentarios más antiguos
When I plot the frequency domain the power is not 3 and 5 as I expect. I read the documentation for fft() and cannot figure out how to normalize my fft properly. Can someone explain the procedure to normalize the cosines and a Gaussian wave? Thanks
clear all;
%generate the signal
t = 0:1/2000:.02;
x = 3*cos(2*pi*60*t) + 5*cos(2*pi*200*t);
%sample the signal
fs = 1000;
t1000 = 0:1/fs:.02; % number of sample points
n1000 = 0:length(t1000)-1; % number of intervals
x1000 = 3*cos(2*pi*60*n1000/1000) + 5*cos(2*pi*200*n1000/1000) ; %cos(2*pi*60*n*ts);
%Compute FT
z = fftshift(fft(x1000));
f = -fs/2: fs/(length(n1000)-1): fs/2 ;
%plot time domain
figure
subplot(2,1,1)
plot(t,x)
hold on;
grid on;
stem(t1000, x1000, 'filled', 'r', 'LineWidth', 2);
%plot freq domain
subplot(2,1,2);
plot(f,abs(z)); %normalization??
grid on;
xticks(-500:50:500);
xlim([-300 300]);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Spectral Measurements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!