From: someone on 19 Jul 2010 15:07 "Heman " <kokahemant(a)hotmail.com> wrote in message <i226bp$fuc$1(a)fred.mathworks.com>... > "someone" <someone(a)somewhere.net> wrote in message <i225ai$afo$1(a)fred.mathworks.com>... > > "Heman " <kokahemant(a)hotmail.com> wrote in message <i223ab$2d6$1(a)fred.mathworks.com>... > > > Hi all, > > > > > > I am trying to run this matlab code but am facing with a few errors. Can some one help me out? > > > I ran this code with a random input signal and it was working. Now i tried running with the input file which has 1024 hexadecimal values. > > > snip ... > > It would help us if you said what the errror messages were a least. > > I cannot put the input file as its 1024 hexadecimal data. so its a very big file. I dont know if there is an option of attaching the files here. The eror messages: > > ??? Error using ==> horzcat > CAT arguments dimensions are not consistent. > > Error in ==> lms_prof at 36 > x1=[x(n:-1:1)' zeros(1,ntaps-n)]; > ********** > I then changed the statement to > x1=[x(n:-1:1) zeros(1,ntaps-n)]; > ******** OK, that was a good try. It depends on what you want x1 to be, a row vector, a column vector, or a matrix. Other possibilities are: > x1=[x(n:-1:1)'; zeros(ntaps-n,1)]; > x1=[x(n:-1:1); zeros(1,ntaps-n)]; Are n:-1:1 and 1:(ntaps-n) the same length? Or are you just "zero padding" your vector? > The next error : > ??? Error using ==> mtimes > Inner matrix dimensions must agree. > > Error in ==> lms_prof at 41 > y(n)=x1*h'; > ***************** > The dimentions of h and x1 are 1x64. I changed the statement to y(n)=x1'*h; > But still same error. The above are matrix multiplies, by default, in MATLAB. If you simply want element-by-element mutiplies, then change: > y(n)=x1*h'; to > y(n)=x1.*h'; % y(n)=x1.*h; would give the same answer as well You may other such problems further down in your code (i.e., change / to ./ etc.). Since it looks like y is a vector, I assume that element-by-element is what you want. But, it is up to you to decide. > > I you want the data file then just let me know i can send an email or if i can attach here then please tell me. I am new to this forum. > > Thank you
From: Heman on 19 Jul 2010 15:38 > > ??? Error using ==> horzcat > > CAT arguments dimensions are not consistent. > > > > Error in ==> lms_prof at 36 > > x1=[x(n:-1:1)' zeros(1,ntaps-n)]; > > ********** > > I then changed the statement to > > x1=[x(n:-1:1) zeros(1,ntaps-n)]; > > ******** > > OK, that was a good try. It depends on what you want x1 to be, a row vector, a column vector, or a matrix. Other possibilities are: > > > x1=[x(n:-1:1)'; zeros(ntaps-n,1)]; > > x1=[x(n:-1:1); zeros(1,ntaps-n)]; Neither one works. It gives me error. the only option which i tried earlier works here. > > Are n:-1:1 and 1:(ntaps-n) the same length? > Or are you just "zero padding" your vector? yes, i am padding zeros. > > > The next error : > > ??? Error using ==> mtimes > > Inner matrix dimensions must agree. > > > > Error in ==> lms_prof at 41 > > y(n)=x1*h'; > > ***************** > > The dimentions of h and x1 are 1x64. I changed the statement to y(n)=x1'*h; > > But still same error. > > The above are matrix multiplies, by default, in MATLAB. If you simply want element-by-element mutiplies, then change: > > y(n)=x1*h'; > to > > y(n)=x1.*h'; % y(n)=x1.*h; would give the same answer as well > I tried these options. still the following erorrs: ??? In an assignment A(I) = B, the number of elements in B and I must be the same. Error in ==> lms_prof at 41 y(n)=x1.*h; ******* ??? Error using ==> times Matrix dimensions must agree. Error in ==> lms_prof at 41 y(n)=x1.*h'; > You may other such problems further down in your code (i.e., change / to ./ etc.). > Since it looks like y is a vector, I assume that element-by-element is what you want. > But, it is up to you to decide.
From: Andy on 19 Jul 2010 15:52 I think the error message is very clear: x1 and h are not the size you think they are. Type: dbstop if error Then run your code. When it errors, type: size(x1) size(h) and post the result here.
From: Heman on 19 Jul 2010 16:14 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i22ad5$787$1(a)fred.mathworks.com>... > I think the error message is very clear: x1 and h are not the size you think they are. Type: > > dbstop if error > > Then run your code. When it errors, type: > > size(x1) > size(h) > > and post the result here. I did as you said here are the display results: ??? Error using ==> times Matrix dimensions must agree. Error in ==> lms_prof at 45 y(n)=x1.*h'; K>> size(h) ans = 1 64 K>> size(x1) ans = 1 64
From: Andy on 19 Jul 2010 16:23 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.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Powers are slow, multiplies fast; optimized badly? Next: checking/setting part of an array. |