From: Heman on 19 Jul 2010 16:29 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i22c7p$5rj$1(a)fred.mathworks.com>... > Well there is your problem. If h is 1x64, then h' is 64x1. When using the .* element-by-element multiplication, both arrays need to be the same size. So you cannot use .* to multiply the elements of a 1x64 array with the elements of a 64x1 array. but even if i use the just * and not .* the error remains the same but this time the size is different. ??? Error using ==> mtimes Inner matrix dimensions must agree. Error in ==> lms_prof at 45 y(n)=x1*h'; K>> size(x1) ans = 64 1 K>> size(h) ans = 1 64
From: Andy on 19 Jul 2010 16:38 "Heman " <kokahemant(a)hotmail.com> wrote in message <i22cje$sl8$1(a)fred.mathworks.com>... > "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i22c7p$5rj$1(a)fred.mathworks.com>... > > Well there is your problem. If h is 1x64, then h' is 64x1. When using the .* element-by-element multiplication, both arrays need to be the same size. So you cannot use .* to multiply the elements of a 1x64 array with the elements of a 64x1 array. > > but even if i use the just * and not .* the error remains the same but this time the size is different. > > ??? Error using ==> mtimes > Inner matrix dimensions must agree. > > Error in ==> lms_prof at 45 > y(n)=x1*h'; > > K>> size(x1) > > ans = > > 64 1 > > K>> size(h) > > ans = > > 1 64 Two wrongs don't make a right. You appear to have transposed your x1, since it is not 64x1 instead of 1x64. And you changed .* to just *. But h' is still 64x1, so now you're trying to do a matrix multiplication of a 64x1 with a 64x1. The inner dimensions don't agree, so you get the error you've shown.
From: someone on 19 Jul 2010 16:58 "Heman " <kokahemant(a)hotmail.com> wrote in message <i22cje$sl8$1(a)fred.mathworks.com>... > "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i22c7p$5rj$1(a)fred.mathworks.com>... > > Well there is your problem. If h is 1x64, then h' is 64x1. When using the .* element-by-element multiplication, both arrays need to be the same size. So you cannot use .* to multiply the elements of a 1x64 array with the elements of a 64x1 array. > > but even if i use the just * and not .* the error remains the same but this time the size is different. > > ??? Error using ==> mtimes > Inner matrix dimensions must agree. > > Error in ==> lms_prof at 45 > y(n)=x1*h'; > > K>> size(x1) > > ans = > > 64 1 > > K>> size(h) > > ans = > > 1 64 In one of the previous posts you said you were sure the dimensions of h & x1 were the same. It appears they are not. May I suggest that rather than just "randomly" trying various combinations of transposes and multiplies (matrix vs element-by-element) that you take a moment and read the MATLAB Getting Started Guide: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/getstart.pdf It is a quick read and is full of information that will be useful to you.
From: Heman on 19 Jul 2010 17:20 Hi Andy & Someone, Thanks soo much. I have finally resolved the error. It was nothing to do with the y(n) but with this. if n<= ntaps x1=[x(n:-1:1) zeros(1,ntaps-n)]; else x1=x(n:-1:n-ntaps+1); end remember Someone, i said i removed the transpose and it worked. But the else part was still having the transpose. I removed this and now there are no errors. But the values of hh are NaN even though e(n), x1 and ibeta are all having values. y(n)=x1*h'; e(n)=d(n)-y(n); hh=e(n)*x1/ibeta h=h+hh; Thanks Someone for that document.
From: Heman on 19 Jul 2010 17:40 > remember Someone, i said i removed the transpose and it worked. But the else part was still having the transpose. I removed this and now there are no errors. But the values of hh are NaN even though e(n), x1 and ibeta are all having values. > > y(n)=x1*h'; > e(n)=d(n)-y(n); > hh=e(n)*x1/ibeta > h=h+hh; > > Thanks Someone for that document. Guyz, I am trying to debug this new problem and i found that the value of y(n) gets to be NaN when n=44, x1 and h have values but i don't understand how the result is NaN. any suggestions frineds? thanks
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Powers are slow, multiplies fast; optimized badly? Next: checking/setting part of an array. |