In this paper, a procedure for designing a MATLAB-based virtual robotics laboratory is described that provides a realistic three-dimensional animation for the robot’s motion. The proposed laboratory allows students to obtain the linear model and stability condition of a robotic system, without getting involved in its mathematical modeling. The structure of a two-wheeled inverted pendulum robot has been used for demonstrating the laboratory’s features. As part of this virtual experiment, design and evaluation of proportional–integral–derivative, model predictive control, and fuzzy controllers for maintaining the two-wheeled inverted pendulum’s balance are considered. A set of graphical–user interfaces is designed for providing the interaction with the system. This virtual lab is readily extensible for other robotics structures and controllers, and its output data is promptly available for further analysis by other MATLAB toolboxes.