Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab error matrix function

  1. Apr 25, 2016 #1
    Here is a link the code which I am trying to modify. It is the radial average of a matrix function.


    I want to restrict the function to only look within certain angles, e.g. 15 degrees either side of the y axis.

    The matrix is centred about the axis I think in this function.

    I have tried to use conditions which I add to the first line in the for loop such as :

    Y/X > some value, which would restrict to a conic section.

    But I get the error "Matrix is singular to working precision" and i dont know why. Its probably evident, but I am a beginner rarely use Matlab.

  2. jcsd
  3. Apr 26, 2016 #2


    Staff: Mentor

  4. Apr 30, 2016 #3


    User Avatar
    Gold Member

    I think you want to use this instead:

    Y./X > some value

    When you're working with simple numbers, / and ./ are the same. But once you start talking about vectors and matrices they become different operations.

    ./ is for element-wise division.
    / is for solving the linear equation xA=B for x

    The condition number of the matrices becomes irrelevant if you use ./
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Matlab error matrix function