On 24 May 2011 10:41, Przemek Klosowski<address@hidden> wrote:
I have numbers which are approximately (but not exactly) an integer number
of some basic quantity. How would you estimate that basic quantum? For
instance, if the data is:
a= [5500 3800 3300 3800 4000 5500 2600 3800 5500 2500 4000 6000 4000 450
1550 1000 3800 5300 5300 1800 3800 1550 2500 3300 1300 2500 3300 2500 1550
5500 2200 3500 3300 2200 1300 800 2200 1000 2500 5300 3000 2200 2200 2200
4000 2400 2200 5500 4000 800 2200 2600 450 450 ]
[snip]
Can anyone think of a more precise numerical algorithm?
The subject of this thread should be about greatest, not least common
factor, right?
So it's a problem about finding the relative mininum of the following
objective functions:
f = @(x) norm(fmod(bsxfun(@rdivide, a(:), x(:)'),1),"columns");
i.e. looking at the x that minimises the norm of the fractional part
of the vector a divided by a proposed quantum x.