%% Plot Path of Bicycle Kinematic Robot
%
% Create a robot and set its initial starting position and orientation.

kinematicModel = bicycleKinematics;
initialState = [0 0 0];

%
% Set the timespan of the simulation to 1 s with 0.05 s timesteps and the input commands to 2 m/s and left turn. Simulate the motion of the robot by using the ode45 solver on the derivative function.

tspan = 0:0.05:1;
inputs = [2 pi/4]; %Turn left
[t,y] = ode45(@(t,y)derivative(kinematicModel,y,inputs),tspan,initialState);

%
% Plot the path.

figure
plot(y(:,1),y(:,2))

% Copyright 2021 The MathWorks, Inc.