Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Matrix dimensions must agree
Replies: 7   Last Post: Oct 20, 2011 2:30 PM

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: Matrix dimensions must agree
Posted: Oct 20, 2011 11:42 AM

"Halley " <halleykholmes@gmail.com> wrote in message
news:j7pdmt\$3o9\$1@newscl01ah.mathworks.com...
> I am trying to write a program that utilizes the inverse iterative method.
> I calculate an initial x value and rho value given the matrices A, B, and
> b. I calculate a value of x normalized to the matrix B (xnorm) as well as
> a new value for rho for each iteration. Given that the relative error of
> rho is less than my preset tolerance (TOL) the loop ends, otherwise xnorm
> becomes the new value for x and the rho(i+1) becomes rho(i). The problem
> is in calculating rho(i), I am told my matrix dimensions do not agree when
> I have checked the sizes multiple times. Any suggestions? Thanks.

Set an error breakpoint and run your code, then when you reach the line on
which MATLAB throws the error check the dimensions of the variables and
expressions that are being used on that line at that specific point in time.
If those dimensions are different than you expect, work your way back
through the code determining when the dimensions changed from what you
expect and then determine why.

http://www.mathworks.com/help/techdoc/matlab_env/brqxeeu-175.html#brqxeeu-242

If the line on which the error is thrown is in a loop, using a conditional
breakpoint (described earlier in the page to which I linked) to stop on a
particular line during a particular loop iteration may be of use to you as
you work your way backwards in your code to determine the root cause of the
dimension change.

--
Steve Lord
slord@mathworks.com
http://www.mathworks.com

Date Subject Author
10/20/11 Halley
10/20/11 Matt J
10/20/11 Halley
10/20/11 Halley
10/20/11 Matt J
10/20/11 HB
10/20/11 HB
10/20/11 Steven Lord