Why am I getting a 'Matrix is singular to working precision' error in Matlab?

In summary, the conversation discusses modifying a code for radial averaging of a matrix function. The goal is to restrict the function to only look within certain angles, but the attempt to do so using conditions in a for loop results in a "Matrix is singular to working precision" error. The article linked by Mathworks suggests using element-wise division instead of solving a linear equation.
  • #1
rolotomassi
53
0
Here is a link the code which I am trying to modify. It is the radial average of a matrix function.

http://uk.mathworks.com/matlabcentral/fileexchange/46468-radialavg-zip/content/radialavg.m

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 don't know why. Its probably evident, but I am a beginner rarely use Matlab.

Thanks
 
Physics news on Phys.org
  • #2
This article from Mathworks may help:

https://www.mathworks.com/matlabcentral/newsreader/view_thread/170201
 
  • #3
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 ./
 

1. What is a "Matlab error matrix function"?

A "Matlab error matrix function" is a function in the Matlab programming language that is used to calculate and display information about errors in a matrix. This can be useful for debugging code and identifying errors in data.

2. How do I use the Matlab error matrix function?

To use the Matlab error matrix function, you need to first have a matrix in your workspace. Then, you can use the "error" command followed by the name of the matrix to display the error matrix. Alternatively, you can also use the "errordlg" command to create a pop-up window displaying the error matrix.

3. What information does the Matlab error matrix function provide?

The Matlab error matrix function provides information about the size, shape, and values of the errors in a matrix. It also displays the location of the errors within the matrix, making it easier to identify and fix them.

4. Can the Matlab error matrix function be customized?

Yes, the Matlab error matrix function can be customized by using additional input arguments. These arguments can modify the appearance of the error matrix, such as changing the font size or color, or adding a title or labels.

5. Are there any alternatives to the Matlab error matrix function?

Yes, there are other functions in Matlab that can also help with error analysis, such as the "dbstack" function which displays the sequence of functions that led to an error, and the "errorbar" function which can create graphical representations of errors in a plot. Additionally, there are also external tools and packages that can be used for error analysis in Matlab.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
14K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • Programming and Computer Science
Replies
5
Views
9K
Back
Top