J1 = 0.1;
J2 = 0.2;
J3 = 0.05;
if (J1 <= J2 && J1 <= J3)
% min = J1;
J = 1;
else if (J2 <= J3)
% min = J2;
J = 2;
else
% min = J3;
J = 3;
end
end
J
%另一种更简洁的方法
a = [J1 J2 J3];
[m index] = min(a);
J = index