hamming(L) function showing error

I have Matlab R2018a version. The hamming window function shows error. This is what I typed:
hamming(64)
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the
first matrix matches the number of rows in the second matrix.
To perform elementwise multiplication, use '.*'.
Error in SD>@(N)(0.54-0.46*cos(2*pi*[0:N-1].'/(N-1)))
I checked my current software and found I have signal processing toolbox installed in the version. I checked the same hamming(L) function in R2016b and it did not show any errors.
How to rectify this error??

3 件のコメント

dpb
dpb 2018 年 7 月 2 日
編集済み: dpb 2018 年 7 月 3 日
Well, that does seem bogus, indeed.
Just for grins, what does
which -all hamming
return?
Also, always good to copy and paste the actual code line and full error text form the command window in context so can see precisely what was done...sometimes it's just an overlooked "oops!" that somebody else's eyes catch.
ADDENDUM
That doesn't look like same code as in R2016b -- it has vector x calculated initially as
x = (0:m-1)'/(n-1);
and computes the weights vector with straight vector expression
w = 0.42 - 0.5*cos(2*pi*x) + 0.08*cos(4*pi*x);
Looks like they tried to get clever and use an anonymous functions or somesuch from the error message and screwed up. Looks like bug report time to me.
119004180 Siddharth S
119004180 Siddharth S 2018 年 7 月 3 日
Thanks dpb!.. I checked and found that the anonymous function hamming=@(N)(0.54-0.46*cos(2*pi*[0:N-1].'/(N-1)))... seems to have some error, because i tried hamming(L) function after clearing the previous anonymous function from the workspace and the hamming function worked fine. Thanks for the input!
dpb
dpb 2018 年 7 月 3 日
Ah! I thought perhaps TMW had tried to get clever in the Toolbox by making dynamic-assigned functions or the like.
But,
hamming=@(N)(0.54-0.46*cos(2*pi*[0:N-1].'/(N-1)));
works as written here; it's within double-precision roundoff of the result of the builtin function so not sure what went wrong; it isn't obvious from the info available certainly.
I'm now guessing that

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

回答 (0 件)

質問済み:

2018 年 7 月 2 日

コメント済み:

dpb
2018 年 7 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by