function [value,pos]=findnear(A,b)
dist=abs(A-b);
[pos(1),pos(2)]=find(dist == repmat(min(dist(:)),size(dist))); %Min of distance vector
value=[A(pos(1),pos(2)),pos(1)];
%returns the value of min distance from desired wn as well as position in array
