In this article an educational embedded mechatronic system based on the MATLAB xPC target is presented. xPC target, a tool provided by MATLAB and its Simulink toolbox, offers a practical means for developing a hardware-in-the-loop (HIL) simulation environment. Since ordinary personal computers (PCs) can be used for modeling, analysis, design, monitoring, and control of the process, the setup becomes suitable for rapid-prototyping, research, and educational use. An application example of a double inverted pendulum on a cart that is digitally controlled is presented and discussed. The system is fully implemented by means of two PCs, MATLAB, Simulink, xPC target, a data acquisition card, an AC servomotor, and three optical encoders. It is shown that, through this technology, high sampling frequencies can be obtained by even using a Pentium III PC. Tele monitoring and control through a network are demonstrated.