How to work with a matrix close to singular in MATLAB ?

29 views (last 30 days)
I've ill-conditioned matrix which shows its inverse close to singular. So, the minimization solution is unstable. The psedoinverse gives abruptly different outcome from the inverse. Is there any method to handle this kind of issue in matlab?
Thanks

Accepted Answer

John D'Errico
John D'Errico on 27 Oct 2020
Sorry, but no magic exists. This is why numerical linear algebra exists as an area of mathematics, and why courses are taught in the subject.
Does a soution exist? Possibly. This will typically either involve learning why your matrix becomes singular, Is this an issue of the problem you are solving? Poor data perhaps? A poorly formulated problem? Poorly written code? A poorly scaled problem? Just a nasty problem to solve? Are you trying to solve a big problem with insufficient information? Who knows? We are not omniscient, and our MATLAB crystal ball cannot see into your computer or your mind.
If it is one of the above issues, then you may be able to fix it by getting better data, by improving the algorithm, by rescaling the data, by getting more or better data. We cannot know.
Can you use a pseudo-inverse in some way to deal with it? Again, it is possible, but of course, we are given no clue as you your code, what algorithm is even involved, nothing.
If you are willing to show ALL of your code, explain what you are doing AND provide any data to run the code, we MAY be able to help.
You probably need to sit down with someone who has the expertise to undertand what you are doing. This may be your thesis advior, your boss, a colleague. Explain clearly what you are trying to do. Show them what you see as the problem.
But unless you are willing to provide considerably more information, I'm sorry, but working with a singular matrix is like dividing by zero.
  1 Comment
HN
HN on 27 Oct 2020
Edited: HN on 29 Oct 2020
Below is the program.
close all;
clearvars
t=0:ts:1;
for k=1:length(t)
th(k)=-0.2*cos(2*pi*t(k));
psi(k)=0.2*sin(2*pi*t(k));
end
end

Sign in to comment.

More Answers (0)

Categories

Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!