function [road] = makeroad(height, length, velocity) % function [road] = makeroad(height, length, velocity) % % Generates a section of road given parameters. % % Returns a single matrix consisting of two columns. % The second column should be the road height, and % the first column should be the time at which the % car reaches that point in the road, assuming a % constant velocity. % dt = length / velocity; time = linspace(0, dt); time = time'; rh = height/2 * ( 1 - cos( 2*3.1415926 * time / dt )); road = [ time rh ];