View raw

1 function ds = get_ds(xi,xf,u) 2 3 dist = 0; 4 numSteps = 10; 5 dx = (xf-xi)/numSteps; 6 z0 = get_z(xi,u); 7 x0 = xi; 8 for i=1:10 9 tempX = x0+dx; 10 if tempX > 0 11 tempZ = get_z(tempX,u); 12 else 13 tempZ = 0; 14 end 15 dist = dist + (dx^2+(tempZ-z0)^2)^.5; 16 z0 = tempZ; 17 x0 = tempX; 18 end 19 20 ds =dist;