Closed-Loop Design Of Brain-Machine Interface Systems