www.pudn.com > RS_BCM_255_223_4[1].Matlab.rar > compare.m, change:2007-04-16,size:506b


function [min_metrics,sym_out]=compare(sys,a,b)
%UNTITLED1 Summary of this function goes here
%  Detailed explanation goes here
%suba=de2bi(sys,3)-de2bi(a,3);
%subb=de2bi(sys,3)-de2bi(b,3);
%tempa=suba(1).^2+suba(2).^2+suba(3).^2;
%tempb=subb(1).^2+subb(2).^2+subb(3).^2;
if a==0
    temp8=abs(sys-8);
    temp0=abs(sys-0);
    tempa=min(temp8,temp0);
else
    tempa=abs(sys-a);
end
    tempb=abs(sys-b);
if tempa<=tempb
    min_metrics=tempa;
    sym_out=a;
else
    min_metrics=tempb;
    sym_out=b;
end