DOC PREVIEW
GVSU EGR 345 - Analysis of Dynamic Systems Using Numerical Methods in Software Applications

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Analysis of Dynamic Systems Using Numerical Methods in Software Applications By Brad Peirson School of Engineering Grand Valley State University Laboratory #2 EGR 345 – Dynamic Systems Modeling and Control Section 02 Instructor: Dr. Barakat Sept. 15, 2005Executive Summary The objective for this laboratory was to produce two sets of two programs that would perform accurate numerical analysis on an equation or set of equation. Each set of two programs contained one C and one Scilab program. The first set was intended to numerically integrate a given function (1). The second set was intended to provide a numerical solution for a mass-spring-damper system. All of the programs compiled and executed as expected. The similarity of the output between the C and Scilab programs suggest that the outputs for each are an accurate representation of the exact integral for each case. 1.0 Introduction The first task included in this laboratory was to demonstrate numerical integration of the given equation, (1). ttttf)59sin(5)(−+= (1) An exact integral can be calculated for this equation, however this method would prove extremely time consuming. The preferred method is to use numerical approximations to obtain a fairly precise estimate of the integral. A numerical approximation of an integral can be extremely accurate given an adequate number of integration steps. The second task in this laboratory was to derive state equations from a given system and solve them using numerical approximation. The system is shown in Figure 1. 1Figure 1: Mass-Spring-Damper System The first step to numerically solving a system such as hat shown in Figure 1 is to derive the differential equations. In order to obtain a numerical approximation the differential equations must be converted to state form. State equations are easily transposed into matrices. Because software applications written in either C or Scilab are both capable of analyzing matrices both software methods are well suited to solving such a system of equations. 2.0 Experimental Procedure The first stage in writing the program for the numerical integration of (1) was to decide the best method for the integration. Because an integral is defined as the area under the curve of a function, there were many different methods that could have been applied to find the area. The plot of the function is shown in Figure 2. 2Figure 2: Plot of First Laboratory Equation Because of the nature of the function calculating a definite integral would be extremely difficult. It was decided to use rectangular integration to find the area under the curve. This method sums the areas of many small rectangles that all fit under the curve. The only necessary user inputs were the range of integration and the number of rectangles desired. The width of a single rectangle was then found in the program by using equation (2). stepsrangeofstartrangeofendwidth#____−= (2) The height of each individual rectangle was found by substituting the value for t at the center of the rectangle into equation (1). The area of each rectangle was then found by multiplying the height by the width. Each program then summed the areas of all of the rectangles and displayed the total area under the curve for the given range. The source code for both the C and Scilab programs are given in Appendix A. 3The second task for this laboratory was to perform a similar numerical integration on the system shown in Figure 1. The first step to accomplishing this was to derive the differential equations that govern the system. These equations are shown in (3) and (4). 0212212121112111=−−⎟⎟⎠⎞⎜⎜⎝⎛++⎟⎟⎠⎞⎜⎜⎝⎛++ xMKxMKMKKxMKKxxsdssdd&&&& (3) 02112122232223222=−−−⎟⎟⎠⎞⎜⎜⎝⎛++⎟⎟⎠⎞⎜⎜⎝⎛++MFxMKxMKMKKxMKKxxsdssdd&&&& (4) Equations (3) and (4) were then restated in state variable form before they were programmed into the applications. The state variable forms of equations (3) and (4) are shown in (5) and (6) respectively. 212212121112111xMKvMKMKKxMKKvvsdssdd++⎟⎟⎠⎞⎜⎜⎝⎛+−⎟⎟⎠⎞⎜⎜⎝⎛+−=& (5) 2112122232223222MFxMKvMKMKKxMKKvvsdssdd+++⎟⎟⎠⎞⎜⎜⎝⎛+−⎟⎟⎠⎞⎜⎜⎝⎛+−=& (6) The state equations were then stated in matrix form and input into the source code for the integration programs. It was decided that the best way to code these applications was to prompt the user for only the limits of integration and the desired steps. The source code for both the C and Scilab programs are given in Appendix B. 43.0 Experimental Results The programs themselves were written and tested with randomly chose intervals. Figures 3 and 4 show the outputs of the C and Scilab programs, respectively, for the interval t=1 to t=10 with 100 steps. prelab_integral.c This program will integrate a simple equation using a few inputs from the user. The equation being integrated is f(t) = 5t + sin(9t-5)/t. Press ENTER to continue. Where should the integration range begin? ->1 Where should the integration range stop? ->10 How many steps would you like the integral to take? ->100 The value of the integral is 249.874181 Figure 3: prelab_integral.c Output The C version of the integration program shows that the value of the integral from t=1 to t=10 with 100 steps is approximately equal to 249.87. Figure 4 shows the corresponding Scilab output. Where should the integration range begin? -->1 Where should the integration range end? -->10 How many steps would you like the integral to take? -->100 The value of the integral is 249.874181 Figure 4: prelab_integral.sce Output The Scilab program returned the same value as the C program in every test interval. The Scilab program, given in appendix A, was written slightly differently than the C program. The values that Scilab returned initially did match those of the C program. The Scilab program was re-written to apply a slightly different method of rectangular integration. 5The Scilab program finds the value of the function at the center of each rectangle by finding the value of the function at the start point and adding to it the width of a single rectangle times the index value for the given rectangle. These values of the function for each rectangle are then summed. Finally the total sum of the function values for each rectangle was multiplied by


View Full Document

GVSU EGR 345 - Analysis of Dynamic Systems Using Numerical Methods in Software Applications

Documents in this Course
Y Axis

Y Axis

2 pages

Load more
Download Analysis of Dynamic Systems Using Numerical Methods in Software Applications
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Analysis of Dynamic Systems Using Numerical Methods in Software Applications and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Analysis of Dynamic Systems Using Numerical Methods in Software Applications 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?