Mechatronics: Demos

Fourier Analysis

Matlab Fourier Files (part 1)
fourier_example.m (1.01 Kb)
This file is the main file that is actually run from the Matlab prompt. It calls the other file.

Matlab Fourier Files (part 2)
fourier_coeffs.m(0.341 Kb)
This file contains the function that calculates one set of Fourier coefficients (An, Bn).

Python Fourier
fourier_example.py(2.009 Kb)
This one file does the same thing as the two Matlab files. It defines a function to calculate the Fourier coefficients and then calls that function and generates example plots.

Fourier Example using Experimental Data
fourier_hw_example.m(0.463 Kb)
fourier_hw_example.py(0.614 Kb)
Example done in class on Wednesday 9/20 of reading in data from a file and performing an FFT.



Bode Plots of Transfer Functions

Lowpass Filter Matlab Demo
lowpass_filter_demo.m(0.924 Kb)
Matlab Demo using transfer functions to find the output voltage of an RC lowpass filter given the input voltage frequency. Also generates a Bode plot.

Python Bode Plot Demo
python_lowpass_demo.py(0.772 Kb)
This file generates a lowpass filter Bode plot using Python. From this file you should be able to learn enough Python to do the homework. To run this file as a script, you need to change to the directory containing the file. This must be done from the IPython prompt. There is tab completion, so start typing the directory and hit tab. You must use forward slashes '/' rather than back slashes. So, to change to My Documents on the H drive type:
cd H:/My(hit tab)
and get cd H:/My\ Documents/
note that spaces must be escaped with a back slash (avoid spaces whenever possible).
So, the full path on my machine is
cd H:/My\ Documents/siue/mechatronics/system_modeling
Once in that directory type:
run python_lowpass_demo.py
and it should run the script and pop up a plot window.



System Modeling and Identification

Step Response and Swept Sine Response of a First Order System
Systems Intro (Matlab) (1.591 Kb)
Systems Intro (Python)(1.834 Kb)
Introduction to step responses and system identification.

Important Python Note for Simulation
ltisys.py(16.682 Kb)
Python users must replace the file ltisys.py in the folder:
C:\Python24\Lib\site-packages\scipy\signal
with this one to run the simulations (otherwise you will get an error message).