FFT of a row of data (for a beginner)
Mostrar comentarios más antiguos
Hello, I am an undergraduate student and I want to use the fft function to change a row of data points from the time domain to the frequency domain and then get the power spectrum. The row in question is a 1x600010 matrix of int16 type, taken from a 16x600010 int16 matrix. Right now my code is:
limits = [1 600010];
figure(1)
x = (1:600010);
y = double(Data(1,:))
plot(x,y,'r');
xlim(limits);
fs = 1000;
t = 0:1/fs:600010-1/fs;
m = length(y);
n = pow2(nextpow2(m));
Y = fft(y,n);
f = (0:n-1)*(fs/n);
power = Y.*conj(Y)/n
figure(2)
plot(f,power)
MATLAB says that there is an error in this line: Y = fft(y,n) because 'fft' is an undefined function for input arguments of type 'int16'. How do I change the type of the matrix for it to be compatible with the code, if possible?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Fourier Analysis and Filtering en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!