Rank: 418 based on 167 downloads (last 30 days) and 12 files submitted
photo

Zachary Danziger

E-mail
Company/University
Duke University

Personal Profile:

Postdoctoral researcher in neuroscience.

Web: https://sites.google.com/site/zdanziger/home

Professional Interests:
computational motor control

 

Watch this Author's files

 

Files Posted by Zachary View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 May 2013 Screenshot Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger curves, mathematics, metric, similarity, measure, frechet 52 13
  • 4.5
4.5 | 3 ratings
03 Apr 2013 Screenshot Text Yahtzee Play Yahtzee in the command window, with multiple players per game. Author: Zachary Danziger games, game 4 0
  • 5.0
5.0 | 1 rating
03 Apr 2013 Screenshot Hausdorff Distance Calculates the Hausdorff Distance between two sets of points in a Euclidean metric space. Author: Zachary Danziger distance, mathematics, metric, trajectory similarity 74 4
  • 4.25
4.2 | 4 ratings
03 Apr 2013 Screenshot Variable Frequency Sine Wave Create a sine wave by defining the frequency over a series of intervals. Author: Zachary Danziger mathematics 8 0
31 Jul 2012 Screenshot ChessPeace Software for playing Chess and Chess Variants Author: Zachary Danziger game, games, chess, artificial intelligen..., ai, graphics 13 0
Comments and Ratings by Zachary View all
Updated File Comments Rating
04 Jun 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger

Arthur,
If you are just looking for the standard Euclidean distance you can leave off the dfcn argument and it will be used by default.

Otherwise it expects a function handle. The 'ordinary' distance function is passed as:
dfcn = @(p,q) sqrt(sum( (p-q).^2 ));

But any function will work that operates on points p and q that respects their dimensionality. A Chebyshev-like measure could be used, for example:
dcheb = @(p,q) max(abs(p-q))

29 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger

Thanks for all your help Lingji, it's certainly a better tool now.

24 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger

Lingji,

I cannot see a way to calculate the coupling distance during the recursive calls to c(i,j) without additional overhead. I feel that adding computational cost is not justified because, in general, the coupling sequence is not unique and therefore is not especially informative. The coupling sequence is just any allowable (i.e., follows the forward movement rules) sequence between points on P and Q that never has distance greater than cm. In the typical case there are a great many allowable sequences because interchanging many points with small distances does not affect cm if there is a much larger distance later in the sequence.

Here is my compromise: if the user requests the coupling sequence then I calculate the cm as usual, and at the end of the code I loop through the CA variable choosing one workable coupling sequence. I hope this pleases the fans.

17 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger

Lingji,
Thanks for the suggestions. What is the best way to tell when the algorithm has moved to the next point in the chain ("the next time") without storing the data for every recursion?

03 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger

Lingji,

I misunderstood your comment. Yes, the extra inputs to the c function are not needed. I have resubmitted the file with these removed for greater speed. Thank you for your suggestion.

Comments and Ratings on Zachary's Files View all
Updated File Comment by Comments Rating
04 Jun 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger Danziger, Zachary

Arthur,
If you are just looking for the standard Euclidean distance you can leave off the dfcn argument and it will be used by default.

Otherwise it expects a function handle. The 'ordinary' distance function is passed as:
dfcn = @(p,q) sqrt(sum( (p-q).^2 ));

But any function will work that operates on points p and q that respects their dimensionality. A Chebyshev-like measure could be used, for example:
dcheb = @(p,q) max(abs(p-q))

04 Jun 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger Allen, Arthur

Zach and Lingi; I would like to compare two drifter tracks (lat, long pairs). I tried using 'distance' from the Mapping Toolbox, but this dosn't work. Can you provide an example of dfcn function that does work? Thanks,

29 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger Danziger, Zachary

Thanks for all your help Lingji, it's certainly a better tool now.

29 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger Chen, Lingji

Zachary,

I hope you don't mind my posting this modified version; if you like it, feel free to use it to update your package or do whatever you see fit.

function [dFrechet, coupling] = fcn_discreteFrechetDistance(P, Q, dist_fcn)

% P and Q: two curves represented by matrices of size dim by number
% dist_fcn: optional distance function handle; default to Eucleandian

[n1, p] = size(P);
[n2, q] = size(Q);

if (n1 ~= n2)
error('P and Q mismatch');
end

switch nargin
case 2
dist_fcn = @(x, y) sqrt(sum((x - y).^2));
case 3
otherwise
error('wrong number of arguments');
end

% This is worked on by the inner function
CA = -ones(p, q);

% This is also worked on by the inner functions.
% Each cell stores four numbers [[u_last; v_last], [u_new; v_new]].
% The first column is an index into the cell array, and the second column
% is the newly added edge
coupling_cell = cell(p, q);

get_c(p, q);

dFrechet = CA(p, q);
coupling = get_coupling(p, q);

function coupling = get_coupling(i, j)
coupling = [];
uv_this = [i; j];
while(1)
tmp = coupling_cell{uv_this(1), uv_this(2)};
coupling = [tmp(:, 2) coupling];
uv_last = tmp(:, 1);
if (uv_last(1) == -1 )
break;
else
uv_this = uv_last;
end
end

end

function get_c(i, j)
if (CA(i, j) > -1) % value already available
return;
end

d = dist_fcn(P(:, i), Q(:, j));

if (i == 1 && j == 1)
CA(i, j) = d;
coupling_cell{i, j} = [-1 i; -1 j];
elseif (i > 1 && j == 1)
get_c(i - 1, j);
CA(i, j) = max([CA(i - 1, j), d]);
coupling_cell{i, j} = [i - 1, i; j, j];
elseif (i == 1 && j > 1)
get_c(i, j - 1);
CA(i, j) = max([CA(i, j - 1), d]);
coupling_cell{i, j} = [i, i; j - 1, j];
elseif (i > 1 && j > 1)
get_c(i - 1, j - 1);
get_c(i - 1, j);
get_c(i, j - 1);
[val, ind] = min([CA(i - 1, j - 1), CA(i - 1, j), CA(i, j - 1)]);
switch ind
case 1
coupling_cell{i, j} = [i - 1, i; j - 1, j];
case 2
coupling_cell{i, j} = [i - 1, i; j, j];
case 3
coupling_cell{i, j} = [i, i; j - 1, j];
end
CA(i, j) = max(val, d);
end

end

end

24 May 2013 Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger Danziger, Zachary

Lingji,

I cannot see a way to calculate the coupling distance during the recursive calls to c(i,j) without additional overhead. I feel that adding computational cost is not justified because, in general, the coupling sequence is not unique and therefore is not especially informative. The coupling sequence is just any allowable (i.e., follows the forward movement rules) sequence between points on P and Q that never has distance greater than cm. In the typical case there are a great many allowable sequences because interchanging many points with small distances does not affect cm if there is a much larger distance later in the sequence.

Here is my compromise: if the user requests the coupling sequence then I calculate the cm as usual, and at the end of the code I loop through the CA variable choosing one workable coupling sequence. I hope this pleases the fans.

Top Tags Applied by Zachary
mathematics, games, matrix, linear algebra, entertainment
Files Tagged by Zachary View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 May 2013 Screenshot Discrete Frechet Distance The discrete Frechet distance is a scalar measure of similarity between two curves. Author: Zachary Danziger curves, mathematics, metric, similarity, measure, frechet 52 13
  • 4.5
4.5 | 3 ratings
03 Apr 2013 Screenshot Text Yahtzee Play Yahtzee in the command window, with multiple players per game. Author: Zachary Danziger games, game 4 0
  • 5.0
5.0 | 1 rating
03 Apr 2013 Screenshot Hausdorff Distance Calculates the Hausdorff Distance between two sets of points in a Euclidean metric space. Author: Zachary Danziger distance, mathematics, metric, trajectory similarity 74 4
  • 4.25
4.2 | 4 ratings
03 Apr 2013 Screenshot Variable Frequency Sine Wave Create a sine wave by defining the frequency over a series of intervals. Author: Zachary Danziger mathematics 8 0
31 Jul 2012 Screenshot ChessPeace Software for playing Chess and Chess Variants Author: Zachary Danziger game, games, chess, artificial intelligen..., ai, graphics 13 0

Contact us