Using MATLAB and Programming to Simulate Dynamical Systems Cite as: Peter So, course materials for 2.003J / 1.053J Dynamics and Control I, Fall 2007.
Type the following into the M-file. function y = magnitude(v) % Function to compute the magnitude of a vector y = sqrt(dot(v,v)); end. Note that MATLAB ignores any lines that start with a % - this is to allow you to type comments into your programs that will help you, or users of your programs, to understand them. 3.
Dynamical Systems with Applications using MATLAB provides a comprehensive introduction to the theory of dynamical systems and is designed for use by both advanced undergraduate and beginning graduate students. Its vast compilation of applications also makes this text a great resource for applied mathematicians, engineers, physicists, and researchers in economics, …
Dynamical Systems. The objective of this chapter is to discuss the importance of learning to use tools like MATLAB. MATLAB and companion toolboxes provide engineers, scientists, mathematicians, and students of these fields with an environment for technical computing applications. It is much more than a programming language like C, C++ or Fortran.
The main reason for learning MATLAB in EN40 is so you can use it to analyze motion of an engineeringsystem. To do this, you always need to solve a differential equation. MATLAB has powerful numericalmethods to solve differential equations. They are best illustrated by means of examples.
The solver called ‘ode45’ is the basic MATLAB work-horse for solving differential equations. It worksfor most ODEs, but not all. MATLAB has many other choices if ‘ode45’ doesn’t work. Using them isvery similar to using ‘ode45’ but they are based on different numerical algorithms. You can learn a lotmore about MATLAB ODE solvers in the section of the manual shown below
In engineering, the reason we solve equations of motion is usually so that we can select design parametersto make a system behave in a particular way. MATLAB has powerful equation solvers and optimizersthat can be helpful to do this kind of calculation.
The simplest design decisions involve selecting a single design parameter to accomplish some objective.If this is the case, you can always express your design problem in the form of anonlinear equation, whichlooks something like
They are similar in some ways, although they use vastly different languages. Mathematica is bettersuited to algebra ic calculations; MATLAB is better at numerical calculations and data processing. Butmost things that can be done in Mathematica can also be done in MATLAB, and vice-versa.