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

Click For Summary
SUMMARY

The discussion addresses the 'Matrix is singular to working precision' error encountered in Matlab when modifying the radial average function. The user attempts to restrict the function's analysis to a specific angular range but encounters issues due to improper matrix operations. The solution involves using element-wise division (./) instead of standard division (/) to avoid singularity errors. This distinction is crucial when working with vectors and matrices in Matlab.

PREREQUISITES
  • Familiarity with Matlab programming and syntax
  • Understanding of matrix operations in Matlab
  • Knowledge of element-wise versus matrix operations
  • Basic concepts of angular restrictions in mathematical functions
NEXT STEPS
  • Study Matlab's matrix operations and their implications on performance
  • Learn about element-wise operations in Matlab, specifically the use of ./
  • Explore the concept of condition numbers in matrix analysis
  • Investigate how to implement angular restrictions in matrix functions
USEFUL FOR

Matlab users, particularly beginners and those working with matrix functions, who are looking to resolve common errors and improve their understanding of matrix operations.

rolotomassi
Messages
52
Reaction score
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
This article from Mathworks may help:

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

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 3 ·
Replies
3
Views
15K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K