"Roger Stafford" wrote in message <ka8poo$i9t$1@newscl01ah.mathworks.com>...
> "DHIKRA " <hamdi.dhikra5@gmail.com> wrote in message <ka7g3c$dna$1@newscl01ah.mathworks.com>...
> > hello,
> > i have a problem with the code of Hassan RADVARESFAHLAN; Université du Québec; ÉTS; Montréal; CANADA "hausdorff distance" , i d'ont interestand this part of code:
> > f
> > %% Compute distance
> > function[dist] = compute_dist(A, B)
> > m = size(A, 1);
> > n = size(B, 1);
> > dim= size(A, 2);
> > for k = 1:m
> > C = ones(n, 1) * A(k, :);
> > D = (CB) * (CB);
> > D = sqrt(D * ones(dim,1));
> > dist(k) = min(D);
> > end
> > WHAT MEAN OF (CB),c is a vector of a ligne and B???
> > could you please help me to explain this part of code
>         
> I believe the assumption here is that A and B are matrices with equal numbers of columns, namely, 'dim'. Also I strongly suspect the line
>
> D = (CB) * (CB);
>
> is meant to be
>
> D = (CB) .* (CB);
>
> Otherwise, unless n = dim, CB will not be a square matrix and the matrix product would fail. Also a matrix product here would make no sense.
>
> With this understanding, the forloop calculates the square roots of the rowsums of the squares of the differences between the kth row of A and each of the rows of B. The quantity dist(k) is then set to the minimum of these square roots. (I think this code could be improved upon.)
>
> This isn't the Hausdorff distance yet. The maximum of dist(:) over all rows of B will have to be calculated. Then A and B must be interchanged and the whole process repeated. Finally the largest of these two results will be the Hausdorff distance, based on the Euclidean metric distance between the rows of A and B.
>
> (Note that taking the square root could just as well be postponed until the very last step where only one would need to be performed.)
>
> Roger Stafford
thanks a lot mr Roger , I'am grateful for your help
