Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



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/brqxeeu175.html#brqxeeu242
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 To contact Technical Support use the Contact Us link on http://www.mathworks.com



