Last active
June 30, 2023 05:15
-
-
Save terappy/55956c90bf146a4a4cb7c9021da92336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]',''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scilabによるFFTのスペクトル分解のコード