warning: matrix is singular to working precision.

1 view (last 30 days)
sai kumar
sai kumar on 27 Oct 2017
Edited: sai kumar on 28 Oct 2017
I am working on fingerprint feature vectors. Two feature vectors that i got as result are singular. I am getting this error while finding the mahalanobis distance between these two vectors. So is there any other way to overcome this error and get a precise solution.
  3 Comments
John D'Errico
John D'Errico on 27 Oct 2017
Edited: John D'Errico on 27 Oct 2017
Would you call your doctor up, tell them only that you feel ill, but refuse to visit the office, and refuse to tell them any more about the problem?
So, write better code that is robust to such a problem? Since we don't see what you did, how can anyone give a better answer? We cannot read your mind or the inside of your computer memory. Just seeing a huge mess of (typically poorly written) code will not help a lot either, but someone might be willing to wade through it. Really, someone would need to first, fully understand exactly how you are solving the problem, then wade through your code to see why it is not robust. Depending on the complexity of what you have done, this could literally take someone as long to debug as it took you to write the code.
You are the only one who knows the code you wrote. So, learn how to use the debugger. First, find where the problem occurs (a singular matrix.) Then understand why the problem occurs.
sai kumar
sai kumar on 27 Oct 2017
Edited: sai kumar on 27 Oct 2017
My apologies, I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code.Here is where i used this feature extraction module:
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'});
im1 = imread([pathname,filename]);
axes(handles.axes1);
imshow(im1);
axes(handles.axes2);
fe1=ext_finger(im1,1);
set(handles.y,'String',mat2str(fe1));
setappdata(0,'y',fe1);
And here is where i used mahalanobis distance: x and y are the vectors
if true
dct=getappdata(0,'ct');
set(handles.dct,'String',mat2str(dct));
pk=getappdata(0,'pk');
mpk=getappdata(0,'mpk');
msk=pk(1,1);
pk(1,:)=[];
y=pk;
[s1,~]=size(dct);
for i=1:s1
if dct(i,1)==0
if dct(i,2)==0
if dct(i,3)==0
if dct(i,4)==0
if dct(i,5)==mpk
n=dct(i,6);
break;
end
end
end
end
end
end
c=zeros(i,6);
for j=1:i
for k=1:6
c(j,k)=dct(j,k);
end
end
c(j,:)=[];
while j~=0
dct(j,:)=[];
j=j-1;
end
x=dct;
d=mahal(x,y);
if(d<=15)
fprintf('>>fingerprints matched');
c1=reshape(c.',1,[]);
f=numel(c1);
e=1;
while e<6
if(c1(f)==0)
c1(f)=[];
f=f-1;
e=e+1;
else
break;
end
end
m1=zeros(1,f);
for h=1:f
m1(h)=mod(c1(h)^msk,n);
end
m=char(m1);
set(handles.dmessage,'String',m);
else
msgbox('fingerprint didnot match','invalid fingerprint','error');
end
I am very sorry, I am little bit new to matlab.

Sign in to comment.

Answers (2)

sai kumar
sai kumar on 27 Oct 2017
My apologies, I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code.Here is where i used this feature extraction module:
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'});
im1 = imread([pathname,filename]);
axes(handles.axes1);
imshow(im1);
axes(handles.axes2);
fe1=ext_finger(im1,1);
set(handles.y,'String',mat2str(fe1));
setappdata(0,'y',fe1);
And here is where i used mahalanobis distance: x and y are the vectors
if true
dct=getappdata(0,'ct');
set(handles.dct,'String',mat2str(dct));
pk=getappdata(0,'pk');
mpk=getappdata(0,'mpk');
msk=pk(1,1);
pk(1,:)=[];
y=pk;
[s1,~]=size(dct);
for i=1:s1
if dct(i,1)==0
if dct(i,2)==0
if dct(i,3)==0
if dct(i,4)==0
if dct(i,5)==mpk
n=dct(i,6);
break;
end
end
end
end
end
end
c=zeros(i,6);
for j=1:i
for k=1:6
c(j,k)=dct(j,k);
end
end
c(j,:)=[];
while j~=0
dct(j,:)=[];
j=j-1;
end
x=dct;
d=mahal(x,y);
if(d<=15)
fprintf('>>fingerprints matched');
c1=reshape(c.',1,[]);
f=numel(c1);
e=1;
while e<6
if(c1(f)==0)
c1(f)=[];
f=f-1;
e=e+1;
else
break;
end
end
m1=zeros(1,f);
for h=1:f
m1(h)=mod(c1(h)^msk,n);
end
m=char(m1);
set(handles.dmessage,'String',m);
else
msgbox('fingerprint didnot match','invalid fingerprint','error');
end
I am very sorry, I am little bit new to matlab.

sai kumar
sai kumar on 28 Oct 2017
I am begging you please find me a solution.
  2 Comments
Jan
Jan on 28 Oct 2017
Give us a chance to help you and ask a specific question. I do not even understand, what your problem is.
sai kumar
sai kumar on 28 Oct 2017
Edited: sai kumar on 28 Oct 2017
I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code. I need to find mahalanobis distance of two feature vectors to match fingerprint. While i applying mahal(x,y), I got error that is - "matrix is singular to working precision." Is there any other way for me to get through this. please help me. And the code contains so many modules ,that is why i was not able to copy it. thank you.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!