Look at the first few lines:
clear all; close all; clc;
Now you try to get x(start_point) but you never defined it. SO that throws an error. Or if you did (in another script), you blew it away with the clear all command.