Modeling and Simulation in Scilab/Scicos

Up to this point we have deliberately kept most of our examples concise in order to focus on learning Scilab and also to illustrate how simple many types of calculations are with Scilab. However, real scientific inquiries are often more complicated, involve several kinds of software, and have several goals.
In this chapter we provide a few more elaborate application examples to illustrate how Scilab can be used within this more complicated environment of investigation.
Our first application will be the modeling and simulation of a pendulum with N links. With this problem we shall illustrate how a symbolic manipulation package, in this case Maple, can be used to derive the equations of motion of a multibody system and simulate the result in Scilab. This is done using the Lagrangian approach.
The N-link pendulum is a well-known problem in numerical analysis. For large N it is used as a test problem for software used for molecular dynamics simulation. In this case it is very important to know whether energy is conserved.
The N-link pendulum also arises as a model for flexible cables and chains. Several years ago there was a collapse of several towers carrying power. It turned out that the power lines were supported by pairs of chains of insulators and one of these chains had failed and the other was unable to continue to support the power line. In the followup studies, the insulator chains...