Spectrum Analysis using FFT and Hanning Window

4 Ansichten (letzte 30 Tage)
CactusDog
CactusDog am 23 Apr. 2015
Beantwortet: Santhana Raj am 17 Mär. 2017
I need to conduct spectrum analysis on a pre-recorded audio file (.wav), using FFT and a Hanning window (size: 1024).
I am using the MIRtoolbox, DSP System Toolbox and Signal Processing Toolbox.
I've tried to do this using the below code, but keep getting errors.
MATLAB code
>> a1 = miraudio('Canjo.wav','Extract',8,15);
Computing miraudio related to Canjo.wav...
Computing mirsum related to Canjo.wav...
Elapsed time is 0.078341 seconds.
>> L = 1024;
>> w = hann(L);
>> mirspectrum(a1,'Window',w)
Here are the error messages.
MATLAB code
Operands to the || and && operators must be convertible to logical scalar values.
Error in miroptions (line 284)
if length(varg) > i && ...
Error in mirfunction (line 40)
[orig during after] = miroptions(method,orig,specif,varg);
Error in mirspectrum (line 294)
varargout = mirfunction(@mirspectrum,orig,varargin,nargout,specif,@init,@main);
Any help would be very appreciated, thanks!

Antworten (1)

Santhana Raj
Santhana Raj am 17 Mär. 2017
Check the Syntax of the miraudio command.
As far as I can see, when you use 'Extract' option, you have to provide t1,t2,u,f. Out of which f is optional. I see that you have not mentioned u (unit of t1 & t2), which can take the value of 's' or 'sp'.

Community Treasure Hunt

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

Start Hunting!

Translated by