Borrar filtros
Borrar filtros

FFt of X (DATA:901) and y (DATA:901)

5 visualizaciones (últimos 30 días)
Jean Paul Noukimi
Jean Paul Noukimi el 24 de En. de 2018
Comentada: Jordy Jose el 1 de Feb. de 2018
hallo people pls I need your help. I have a plot of reflectance against wavelength. I need to generate the FFT of this data. I though I need to change my wavelength to frequency unit. but the code belows tells me that error'matrix must have the same length. what can do to solve this problem and how I put my y datain the code? or can someone give a generall code I just put my y and X DATA.
Fs = 150; % Sampling frequency t = 0:1/Fs:1; % Time vector of 1 second f = y; % Create a sine wave of f Hz. x cos(2*pi*t*f); nfft = 901; % Length of FFT X = fft(x,nfft); X = X(1:nfft/2); % Take the magnitude of fft of x mx = abs(X); % Frequency vector f = (0:nfft/2-1)*Fs/nfft; Power Spectrum of a Cosine Wave % Generate the plot, title and labels. figure(1); plot(t,x); title('Sine Wave Signal'); xlabel('Time (s)'); ylabel('Amplitude'); figure(2); plot(f,mx); title('Power Spectrum of a Sine Wave'); xlabel('Frequency (Hz)'); ylabel('Power');
  1 comentario
Jordy Jose
Jordy Jose el 1 de Feb. de 2018
Hi Jean,
It will be great if you could put the code in a code block so that it is more readable. That will make it easier for others to comprehend and respond faster.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by