Why do I receive different results when I use RANK function with single precison values?

2 views (last 30 days)
When I use this:
vidObj = mmreader('xylophone.mpg');
rank(single(M))
M = read(vidObj);
[m1,m2,m3,m4] = size(M);
M = reshape(M,[m1*m2 m3*m4]);
r = rank(double(M))
I get this result:
ans = 45
But when I do this with double precison values I get a different result.
>> rank(double(M))
ans =
423
How can I get similar results as double precision?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 May 2010
The code used to calculate RANK function is sensitive to the tolerance value. the tolerance for single precision is much higher that what we get for double.
The workaround to get similar results is to pass a similar value of the tolerance as that used in the double precision case.
s = svd(double(M))
tol = max(size(double(M))) * eps(max(s))
rank(single(M), tol)

More Answers (0)

Categories

Find more on Signal Generation and Preprocessing in Help Center and File Exchange

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!