Skip to content

Instantly share code, notes, and snippets.

@terappy
Last active June 30, 2023 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terappy/55956c90bf146a4a4cb7c9021da92336 to your computer and use it in GitHub Desktop.
Save terappy/55956c90bf146a4a4cb7c9021da92336 to your computer and use it in GitHub Desktop.
clear
// ファイル読み込み
[s,Fs,bits]=wavread('sample.wav');
// wavのサイズ
N = size(s,'c');
// ハミング窓関数生成
win = window('hm',N);
// フーリエ変換
FFT = fft(s.*win);
// 振幅特性を測るため絶対値をとる
FFT_abs = abs(FFT);
// x軸の設定
// Fs/N:分解能、振幅スペクトルはN/2で線対称となるので0~N/2の範囲を使う
x = Fs*(0:(N/2))/N;
// グラフ出力
clf;
scf(0);
plot(x,FFT_abs(1:size(x,'c')));
xtitle('FFT分析','[Hz]','');
@terappy
Copy link
Author

terappy commented Apr 29, 2016

scilabによるFFTのスペクトル分解のコード

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment