How to see freq response of a wave file

20 ビュー (過去 30 日間)
moonman
moonman 2011 年 11 月 1 日
コメント済み: 종민 손 2020 年 7 月 29 日
Hi i am having a wave file
I want to see its frequency response.
How can i see that

採用された回答

Wayne King
Wayne King 2011 年 11 月 1 日
Again, if it's a signal and not a system, we don't say frequency response, but you can just use fft(). That gives you the DFT of the signal, so it is complex-valued. You can visualize the magnitude and phase responses separately. If your signal is real-valued, then the DFT is conjugate symmetric so you only have to keep the "positive" frequencies.
[y,fs] = wavread('foo.wav');
ydft = fft(y);
% I'll assume y has even length
ydft = ydft(1:length(y)/2+1);
% create a frequency vector
freq = 0:fs/length(y):fs/2;
% plot magnitude
subplot(211);
plot(freq,abs(ydft));
% plot phase
subplot(212);
plot(freq,unwrap(angle(ydft)));
xlabel('Hz');
  2 件のコメント
moonman
moonman 2011 年 11 月 1 日
Thanks again
for detailed answer
종민 손
종민 손 2020 年 7 月 29 日
thanks!

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

その他の回答 (4 件)

Dr. Seis
Dr. Seis 2011 年 11 月 1 日
None of the above works? Try:
wave_file = 'name.wav';
[wave_data_time, sample_rate] = wavread(wave_file);
N_temp = length(wave_data);
N = 2^nextpow2(N_temp);
buff = floor((N-N_temp)/2)+1;
Nyq = sample_rate/2;
df = sample_rate/N;
f = -Nyq:df:Nyq-df;
wave_data_time_pad = zeros(size(f));
wave_data_time_pad(buff:buff-1+N_temp) = wave_data_time;
wave_data_freq = fftshift(fft(wave_data_time_pad));
figure;
plot(f,real(wave_data_freq),'b-',f,imag(wave_data_freq),'r-');
  2 件のコメント
Yasir Ali
Yasir Ali 2019 年 3 月 12 日
Iam not understanding code provided by you
my data is [y,fs]=audioread('filename.wav')
how to put it in above code kindly help
Yasir Ali
Yasir Ali 2019 年 3 月 12 日
I also need frequency respinse for it while fs =44100 and y=220500 ×2

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


Honglei Chen
Honglei Chen 2011 年 11 月 1 日
Let's say you have a wav file called foo.wav, you can use spectrum object to see its spectrum
[y,fs] = wavread('foo.wav');
psd(spectrum.periodogram,y,'Fs',fs);
HTH
  2 件のコメント
moonman
moonman 2011 年 11 月 1 日
Hi
thanks
what is capaital Fs and small fs
what values should i give to them
thanks a lot
moonman
moonman 2011 年 11 月 1 日
ok got it
but it is power spectral density
i need freq response

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


Naz
Naz 2011 年 11 月 1 日
f='name.wav';
[x,sr]=wavread(f) ;
Ts=1/sr;
N=2^15;
x=x(1:N)';
time=Ts*(0:length(x)-1);
figure(1)
magx=abs(fft(x));
ssf=(0:N/2-1)/(Ts*N);
plot(ssf,magx(1:N/2))

moonman
moonman 2011 年 11 月 1 日
Can anyone help me I am having wave file I want to see its freq response How can i see that

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by