角速度のデータに対してFFTし、信号の周波数スペクトルを解析、ノイズの周波数範囲を特定、カットオフ周波数の決定をしたい。このコードが合っているか、またコードの追加・改善。
% Load the data
data = xlsread(‘ho130Gyrox.xlsx’);
% FFT of data
N = length(data); % Length of data
Fs = 2000; % Sampling frequency
Y = fft(data); % FFT
Y_abs = abs(Y);
frequencies = (0:N-1)*(Fs/N)/1000; % Frequency axis
% Plot
figure;
plot(frequencies(1:N/2), Y_abs(1:N/2));
xlabel(‘Frequency (kHz)’);
ylabel(‘Power(dB)’);
title(‘Data Frequency Spectrum’);% Load the data
data = xlsread(‘ho130Gyrox.xlsx’);
% FFT of data
N = length(data); % Length of data
Fs = 2000; % Sampling frequency
Y = fft(data); % FFT
Y_abs = abs(Y);
frequencies = (0:N-1)*(Fs/N)/1000; % Frequency axis
% Plot
figure;
plot(frequencies(1:N/2), Y_abs(1:N/2));
xlabel(‘Frequency (kHz)’);
ylabel(‘Power(dB)’);
title(‘Data Frequency Spectrum’); % Load the data
data = xlsread(‘ho130Gyrox.xlsx’);
% FFT of data
N = length(data); % Length of data
Fs = 2000; % Sampling frequency
Y = fft(data); % FFT
Y_abs = abs(Y);
frequencies = (0:N-1)*(Fs/N)/1000; % Frequency axis
% Plot
figure;
plot(frequencies(1:N/2), Y_abs(1:N/2));
xlabel(‘Frequency (kHz)’);
ylabel(‘Power(dB)’);
title(‘Data Frequency Spectrum’); #fft, #フーリエ変換, #データ, #分析, カットオフ周波数 MATLAB Answers — New Questions