4 views (last 30 days)

Show older comments

function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(input,fs,frate)

global mfccDCTMatrix mfccFilterWeights

[r,c]=size(input); % error occur in this line

if(r > c)

input=input';

end

Niels
on 27 Jan 2017

Edited: Niels
on 27 Jan 2017

so...

you changed the order of the input arguments again?... you have to decide yourself wether it shall be

1. case

function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(w1,fs,frate)

or 2. case

function [ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(fs,w1,frate)

to call your function type in your command window

1. case

[ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(w1,fs,frate)

ofc you have the set the variables w1, fs and frate to some values... thats what walter did: also in the command window

w1=rand(50, 864);

fs=9600, 57.2);

frate=57.2;

% then call your function like shown above or

2. case

[ceps,freqresp,fb,fbrecon,freqrecon]=mfcc(fs,w1,frate)

in your picture you put a single number as input for w1, i thought you might expect w1 to be a matrix (since you check its size etc), walter generated a random matrix with size 50x864

Guillaume
on 26 Jan 2017

Clearly, you've called the function without giving it any input. I.e, you should call the function with:

mfcc(somevariable, someothervariable, somethingelse)

Note that calling the first input input is a very bad idea as it overrides the matlab function with the same name. Give that first input a different name.

Also, I would strongly reconsider having global variables. Whatever time saving it may give you now, you'll likely spend twice as much debugging weird issues later on.

Walter Roberson
on 28 Jan 2017

w1 should be the data to be processed.

fs should be the sampling frequency the data was processed for.

frate should be the number of windows that the data will be broken up into. If you do not provide a value then 100 will be used by default.

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

Start Hunting!