Arduino Motor Shield
Your code:

int speedpinA=9;//enable motor A
...
int speedpinB=10;//enable motor 
...
 analogWrite(speedpinA,spead);//input a simulation value to set the speed
 analogWrite(speedpinB,spead);


See https://www.arduino.cc/en/reference/servo


  On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.


(My emphasis).

So, you can't do that, exactly. Perhaps choose other pins for the analogWrite, pins that analogWrite supports, that are not 9 and 10.