Effacer les filtres
Effacer les filtres

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

5 vues (au cours des 30 derniers jours)
Jean Paul Noukimi
Jean Paul Noukimi le 24 Jan 2018
Commenté : Jordy Jose le 1 Fév 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 commentaire
Jordy Jose
Jordy Jose le 1 Fév 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.

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by