Indexed list of all my posts

This list should be frequently updated. Anyway, check my profile if you think that something is missing.

This tutorial could be also called “Python for Control Systems Simulations”. Here I cover the simulations with Scipy and Numpy (mainly) and several related topics. From Matlab-like scripts, to an Object Oriented Simulator.

  1. Setting Up Simulations
  2. Testing C/C++ Controllers
  3. Object Oriented Simulator
  4. Sockets with Python and C
  5. Transfer Functions I: Introduction
  6. Transfer Functions II: System Identification
  7. Transfer Functions III: Multivariable Systems (in progress)
  8. Discrete Events during Simulations

Also, here you have the Github repository where I have all the code uploaded, for free.


Or how to use Scipy to approximate with linear systems

In the previous chapter, we saw how we can make simulations with transfer functions using Scipy and Python, essentially, compared to the simulations with the simulator I designed.

There, I took a transfer function to approximate the nonlinear model of the motorized pendulum. Well, in this tutorial we see how you can adjust the parameters of a linear transfer function to approximate another response curve.

The content is:

  • System identification with first order transfer function.
  • System identification with second order transfer function.
  • Automatic identification with any polynomial transfer function.

Why don’t we go directly for the third approach? Because the…


Another charming hidden place in the province of Cádiz (Spain)

Beach of Camposoto. A windy day. | Photo by Juan Sandubete

Camposoto is the only beach in San Fernando, the small city where I was born. Since I was a kid, I have spent countless afternoons and complete days there. Unspoiled, it has six kilometers of white fine-grain sand, sunsets behind the the Atlantic ocean in front of you and part of the natural park of the Bahía de Cádiz in your back.

But it is not about the beach that I want to talk you today, but the path which takes you there.

It was not until the teenage years that I followed this path in a conscious way; with…


Pendulums and robotics arms are (almost) the same thing

In the previous chapters I have tried to cover almost all the necessary software tools you could need to launch simulations of physic dynamics with Python. From here on, I want to dive in tools for dealing with simulations of different types like: transfer functions, frequency analysis, space state models, simulations with discrete events, Lyapunov functions and similar things!

You know, control engineering with Python.

I don’t know how many chapters I will write, but if you are curious about some particular topic, feel free to ask for it in the comments and I will try to write about it.


Magic places in the province of Cádiz (Spain) which you may not find in a tourist guide.

Tarifa island seafloor, west side. Oct, 2020 | Photo by Juan Sandubete

In this post about charming Cádiz hidden places I want to show you another place which does not appear (usually) in tourist guides: the Tarifa island seafloor.

Tarifa is a very touristic town placed in the very south of Spain. Indeed, it is the southernmost point of continental Europe. Further, from its beaches you can see the north of our neighbor, Africa, only 14km away, and you can arrive Tangier (Morocco) from there in about 1h30min.

In Tarifa, there is a little island known as Isla de Tarifa o Isla de las Palomas, where there is a fort since the…


About integrating the simulations in your applications

Atlantic Ocean from Tarifa seafloor (Spain) | Photo by Juan Sandubete

In the previous chapters of this tutorial we have learnt how to make simulations of dynamics models. The way we have made them until now is useful for offline analysis, but, for online simulations with hardware in the loop or with other software, we may add a little piece of software in order to establish the data transmission.

We will assume that the hardware in the loop has some link which supports sockets (like ESP32 or ESP8266 through WiFi or whatever). If you are interested in serial connections, let me know in the comments!

As always, I assume that you…


In the two previous chapters of this tutorial, the Python code was developed like usual average-user Matlab scripts: sequential and with global variables. The purpose was to make it more understandable for people used to that kind of code, but, that is not a good approach to write reusable and safe code.

So that, in this third part of the tutorial, I will try to adapt the code for it to be something more standard and object-oriented.

As before, I assume that you have read the rest of the tutorial; so, if you have not, here you have the link…


Or how to test them with Python before trying with real systems.

In the previous part of this tutorial we saw the steps for the implementation of a basic dynamic simulation using only Python, Numpy and Scipy. The example was about controlling a DC motor with a nonlinear control law, all considered continuous.

For real-scenario robotics simulations, it is necessary to be able to emulate discrete systems (i.e. digital stuff like micro-controllers) operating together with continuous systems (physical system itself, like the DC motor).

Usually, with high sampling frequency, you can assume that your continuous controller is going to control the system well even if running in a discrete way; but for…


Magic places in the province of Cádiz (Spain) which you may not find in a tourist guide, yet.

Marambay main building in the center of the Cádiz Bay | Photo by Juan Sandubete

Time ago the New York Times spoke about some wonders of Cádiz, a province located in the south of Spain (or in the very south of Europe, to be more accurate) and, although there are some reviews of places where you can go and dishes you should taste, it is huge the amount of beautiful spots of which you can only hear about if you ask local people for recommendations.

This is why I’m not going to tell you about the cathedral or the “Gran Teatro Falla”. I’m sure you can find all information you want googling it. …


From some years now, it has become popular to teach university subjects with the help of Matlab and Simulink. It is justified as it is a plug and play environment which allows to launch all kind of simulations with minor efforts and to focus in the actual content under study. Nice. The problem it originates is the dependence of this property software. Many people cannot simulate dynamics (e.g. a simple DC motor) without using Matlab.

I worked in a project for which engineers were struggling to embed Simulink in a test-bed system as they were not able to simulate the…

Juan Sandubete

Andalusian Robotics Engineer and SCUBA Diver who loves to learn stuff, to build artifacts and to experience nice things. https://www.instagram.com/jsandubete

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store