Hello, I am working on state space design, and have read through all the trouble shooting advice on this website for the above error. I have attached my code. The error is in line 43, the last one. I am not sure what I am doing that is causing this error. Could somebody guide me on what I am doing wrong? Please forgive the horrendous formating. I will also attach the file if that is easier to see.

You are watching: Warning: matrix is singular to working precision


*

https://www.hyakkendana-hashigozake.com/matlabcentral/answers/337474-matrix-is-singular-to-working-precision#comment_450392


The inv documentation explains that mldivide and mrdivide are faster and numerically more accurate compared to using inv and matrix multiplication.
The documentation clearly states "It is seldom necessary to form the explicit inverse of a matrix. A frequent misuse of inv arises when solving the system of linear equations Ax = b. One way to solve the equation is with x = inv(A)*b. A better way, from the standpoint of both execution time and numerical accuracy, is to use the matrix backslash operator x = A. This produces the solution using Gaussian elimination, without explicitly forming the inverse. See mldivide for further information."
*

The warning "Matrix is singular to working precision" occurs if the matrix for which you are trying to calculate the inverse is singular and hence the inverse does not exist.
From your MATLAB script, line 30, I can see that the value of "C*inv(A - B*K)*B" is zero, and hence if you try to calculate inverse for it, you will get that warning message.
*

Can anyone guide me how to resolve the issue? In case below code is not readable, please see the attachments.
% f = Total Cost and the retention time and number of screens are represented by x(1)and x(2), respectively;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


×
*

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other hyakkendana-hashigozake.com country sites are not optimized for visits from your location.

See more: Watch Money Heist Season 1 Episode 15 Online, Watch Money Heist Season 1 Episode 15


hyakkendana-hashigozake.com

Accelerating the pace of engineering and science

hyakkendana-hashigozake.com is the leading developer of mathematical computing software for engineers and scientists.