Home > Mateda2.0 > knowledge_extraction > Pareto-approximations > ComputeDistanceToPoint.m

# ComputeDistanceToPoint

## PURPOSE

[Val] = ComputeDistanceToPoint(Pop,point)

## SYNOPSIS

function[Val] = ComputeDistanceToPoint(Pop,point)

## DESCRIPTION

     [Val] = ComputeDistanceToPoint(Pop,point)
     ComputeDistanceToPoint: Computes the average quadratic distance between vectors
                             in  Pop and a given point.
     INPUTS
     Pop: Each row corresponds to a vector
     point: Vector taken as a reference
     OUTPUT
     Val: Average square difference between vectors and point

     Last version 2/26/2009. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function[Val] = ComputeDistanceToPoint(Pop,point)
    0002 % [Val] = ComputeDistanceToPoint(Pop,point)
    0003 % ComputeDistanceToPoint: Computes the average quadratic distance between vectors
    0004 %                         in  Pop and a given point.
    0005 % INPUTS
    0006 % Pop: Each row corresponds to a vector
    0007 % point: Vector taken as a reference
    0008 % OUTPUT
    0009 % Val: Average square difference between vectors and point
    0010 %
    0011 % Last version 2/26/2009. Roberto Santana (roberto.santana@ehu.es)
    0012
    0013  Val = 0;
    0014
    0015  [PopSize,n] = size(Pop);
    0016
    0017  for i=1:PopSize,
    0018     Val = Val + sum((Pop(i,:)-point).^2);
    0019  end
    0020
    0021  Val = Val/PopSize;