Tie to frequency using F

1 回表示 (過去 30 日間)
Karl Zammit
Karl Zammit 2021 年 5 月 17 日
コメント済み: Karl Zammit 2021 年 5 月 17 日
Hi, I am trying to perform a fft on a series of runs of a vibration analysis with the following code. An empty plot seems to show up, any ideas?
%Frequency Analysis
time = xlsread('Lab-2ciii.xlsx','A1:A300');; % Time Vector
signal = xlsread('Lab-2ciii.xlsx','B1:B300');; % Signal data in Time-Domain
N = length(signal); % Number Of Samples
Ts = mean(diff(time)); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FT_Signal = fft(signal)/N; % Normalized Fourier Transform Of Data
Fv = linspace(0, 1, fix(N/2)+1)*Fn; % Frequency Vector (For ‘plot’ Call)
Iv = 1:length(Fv); % Index Vector (Matches ‘Fv’)
figure(1)
plot(Fv, abs(FT_Signal(Iv))*2)
grid

採用された回答

Geoff Hayes
Geoff Hayes 2021 年 5 月 17 日
Karl - are you reading the correct columns? For example, on my Mac, the time array
time = xlsread('Lab-2ciii.xlsx','A1:A300');
is empty, and the signal array
signal = xlsread('Lab-2ciii.xlsx','B1:B300');
has just a handful of elements
signal =
0.0807
68.4870
0.0002
-0.1851
NaN
68.2636
0.0027
-0.0607
Both correspond to the first and second columns of your spreadsheet. I suspect you want columns E (which seems to correspond to time) and either H, K, or N...all of which have 300 elements.
  1 件のコメント
Karl Zammit
Karl Zammit 2021 年 5 月 17 日
My bad for not commenting that the problem was solved. Thanks a lot nonetheless

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by