20. Lab 2: Numerical Methods
To be able to use Scilab and C programs to model systems.
In order to analyze dynamic systems on computers we will need to use programs to perform the calculations. In this case we will use Scilab and C as our preferred tools.
Programs written in C can be very efficient and fast. Moreover, when we develop a complete system, we can incorporate C programs into a finished product.
Scilab is a clone of the Matlab software package. Both are designed to do matrix oriented mathematics with simple commands.
1. Write a C Program to integrate the area beneath the function below. The program should ask the user for the start and end points, as well as the number of steps. (you can download compilers from http://claymore.engineer.gvsu.edu/~blaucha/c2d2/c2d2.html)
2. Review the Scilab tutorial (see the course home page for a link). Download and install the Scilab software (www.scilab.org).
3. Write a Scilab program that does the same numerical integration used in step 1 (there is a similar example in the numerical methods chapter of the textbook).
4. Write differential equations for the following system. Convert the equations to state form and write C and Scilab programs to solve the state equations.
Computer with internet access.
1. (If necessary, download and install a C compiler.) Enter the C program written for numerical integration and verify the operation.
2. Enter and test the numerical integration Scilab program written for the prelab. Change the step size and determine what step size results on ’convergence’ of the results. Show a graph of the results.
3. Enter the C and Scilab programs for the mechanical system and verify their operation.
4. Change the step size for the C program and determine what step size results on ’convergence’ of the results. Show a graph of the results.
5. Follow the tutorial for creating web pages.
6. Post all of the programs written during the lab to your web page.