Bode plot from WAV

5 ビュー (過去 30 日間)
Jan
Jan 2011 年 2 月 28 日
Hello,
I'm trying to make a bodeplot from a WAV file, I can read the WAV file, get the sampling rate and etc. Just wondering how I can display it as a bode plot, I've read up on the function in matlab but can't get it to work (or don't really understand it)
Thanks!

採用された回答

Paulo Silva
Paulo Silva 2011 年 3 月 1 日
Maybe something similar to this
load handel %this will load a sample music file
%y is the amplitude and Fs the Sampling frequency
T = 1/Fs; % Sample time
L = numel(y); % Length of signal
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,10*log10(2*abs(Y(1:NFFT/2+1))))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('Y in db')
  2 件のコメント
Jan
Jan 2011 年 3 月 1 日
Thats something like it, now why you use T? You calculate it but don't use it again? Is there a reason for it or just a small mistake?
Paulo Silva
Paulo Silva 2011 年 3 月 1 日
The code was adapted from one in the fft documentation, I didn't check if T was needed or not, it's not used in this case.

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

その他の回答 (2 件)

Andreas Goser
Andreas Goser 2011 年 3 月 1 日
A bode diagram is created from a system, representating a system's behaviour.
A WAV file contains a signal. The signal may be also representing a system's response (output), but you need more than the signal to be able to determine the system (also input). Look for the example "step response". Here, a system reacts on a step input with a response (output). But you need to know the input to be able to compute the system.
  1 件のコメント
Jan
Jan 2011 年 3 月 1 日
Alright, I know that but for example if i view the WAV in audacity it gives me on the Y axis the magnitude of the wave (starting from the top with 0 going to -50db for example) and on the x axis the frequencies. I basically want to accomplish the same view.

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


Rajiv Singh
Rajiv Singh 2011 年 3 月 1 日
If all you have is a signal, what you can construct is a power spectrum. If that is what you have in mind, look up "spectrum", "psd" (etc) in Signal Processing Toolbox.
  1 件のコメント
Jan
Jan 2011 年 3 月 1 日
I already have the spectrum (linear and logarithmic), But read my comment on Mr Goser A. Answer.

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

カテゴリ

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