
figure
plot(t,pos,'b', t,pos_desired,'r--', t,direction_volts,'k:'...
    , t,speed_volts,'g')

legend('pos','pos desired', 'direction','speed volts')