Spectrum Analysis using FFT and Hanning Window

11 views (last 30 days)
CactusDog on 23 Apr 2015
Answered: Santhana Raj on 17 Mar 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.
>> 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.
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!

Answers (1)

Santhana Raj
Santhana Raj on 17 Mar 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!