フィルターのクリア

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

5 ビュー (過去 30 日間)
Jean Paul Noukimi
Jean Paul Noukimi 2018 年 1 月 24 日
コメント済み: Jordy Jose 2018 年 2 月 1 日
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 件のコメント
Jordy Jose
Jordy Jose 2018 年 2 月 1 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by