MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Rohit Deo
on 19 Sep 2013

[y,Fs]=wavread('abc.wav'); y=y/(1.01*abs(max(y))); yy=buffer(y,909); N=909; w=window(@hamming,N); fnl=yy.*w;

*No products are associated with this question.*

Answer by Jan Simon
on 19 Sep 2013

Accepted answer

Perhaps the wav file is in stereo. Then `abs(max(y))` is a vector and dividing y by this vector leads to this problem. Or perhaps yy and w do not have equal sizes, such that `yy.*w` must fail.

It would be useful if you post the complete error message, such that we do not have to guess, where the error occurs.

Rohit Deo
on 19 Sep 2013

Dear Sir, the error is posted as it is. and the error is occuring at the line of: fnl=yy.*w

Jan Simon
on 19 Sep 2013

@Rohit: No, "Matrix dimensions must agree" is not the complete message. When you want to discuss an error in the forum, post everything, which belongs to the error message, even if you do not know, if it matters.

You can check the sizes of yy and w by inserting this code:

size(yy) size(w)

What do you see and what should `yy .* w` achieve then?

Rohit Deo
on 20 Sep 2013

Got it Sir! The error is: ??? Error using ==> times Matrix dimensions must agree.

Error in ==> abc at 12 fnl=yy.*w;

Thank you Sir. size() has helped a lot to me. And now, what I've done is,

xy=yy(:,n); fnl=xy.*w;

Now it is working. As I was for n= 0 to (the number of frames i.e-82) Thank you Sir.

## 2 Comments

## dpb (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87666#comment_169885

Cuz they don't??? :)

Check what is

size(max(y))

??

## Rohit Deo (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/87666#comment_170019

thanks :)