The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: Matrix dimensions must agree
Posted: Oct 20, 2011 11:42 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Halley " <> wrote in message
> 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.

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
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.