Here is a file:
http://www.ee.columbia.edu/~dpwe/e6820/matlab/stft.m
and the lines:
else
win = w;
w = length(w);
end
Why w has assigned length(w) if w is not used anymore in code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The third input to stft.m can either be a scalar containing the window size, or the window itself. Internally, the window is represented as
win, the window size asw.Consequently, if the window itself has been passed to the function,
wincan be read directly from the input, andwhas to be replaced by its length in order to be consistent.Replacing
wby its length is not necessary, sincewis no longer used in the code. However, it facilitates debugging, because variables are assigned consistent values, and it facilitates extension of the code, if, in the future, the algorithm is improved in a way that involves the window sizew.In short: the line is currently not needed, but improves maintainability of the code in the long run.