how can i a calibrate servos ?

hi , i have made a robotic arm with 3 servos but the angles that im giving via matlab is not exactly correct . my servos are 0-180 degrees but i think that does most off 180 degrees . how can i calibrate it with code? i use arduino uno and via matlab i communicate with my robotic arm. i use servo.write to send angles but not works correct. i want to use writeMicroseconds() but i cant find it in matlab arduino package. can i anyone help with calibration???thanks!

Below is some servo test code you might try to find the rotation limits of your servos and how they operate.

// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (s to increase or a 
// to decrease) and enter to change servo position 
// (two hands required, one for letter entry and one for enter key)
// use strings like 90x or 1500x for new servo position 
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
Servo myservo;
int pos=1500; //~neutral value for continous rotation servo
//int pos=90;

void setup()
  myservo.attach(7, 400, 2600); //servo control pin, and range if desired
  Serial.println("serial servo incremental test code");
  Serial.println("type a character (s to increase or a to decrease)");
  Serial.println("and enter to change servo position");
  Serial.println("use strings like 90x or 1500x for new servo position");

void loop()
  while (Serial.available()) {
    char c =;  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  if (readString.length() >0) {
    if(readString.indexOf('x') >0) { 
      pos = readString.toInt();

    if(readString =="a"){
      (pos=pos-1); //use larger numbers for larger increments
      if(pos<0) (pos=0); //prevent negative number
    if (readString =="s"){

    if(pos >= 400) //determine servo write method
  readString=""; //empty for next input

They are not precision devices, and they almost certainly don’t do 180 degrees (most do
around 120 to 150 degrees of movement only). You need to work out a way to inform the code
of the actual position which depends on how your arm is configured. Perhaps you need a separate
calibration sketch that you run once and records the offsets in known address in EEPROM.

(most do around 120 to 150 degrees of movement only)

I've used several brands of hobby servos and as best as i remember they usually would rotate from hard stop to hard stop, which is ~190 deg rotation. Note that microsecond command values need to be used instead of the 0-180 deg variation.