For engineering analysis it is always preferable to develop explicit equations that include symbols, but this is not always practical. In cases where the equations are too costly to develop, numerical methods can be used. As their name suggests, numerical methods use numerical calculations (i.e., numbers not symbols) to develop a unique solution to a differential equation. The solution is often in the form of a set of numbers, or a graph. This can then be used to analyze a particular design case. The solution is often returned quickly so that trial and error design techniques may be used. But, without a symbolic equation the system can be harder to understand and manipulate.
This chapter focuses on techniques that can be used for numerically integrating systems of differential equations.
The general process of analyzing systems of differential equations involves first putting the equations into standard form, and then integrating these with one of a number of techniques. State variable equations are the most common standard equation form. In this form all of the equations are reduced to first-order differential equations. These first-order equations are then easily integrated to provide a solution for the system of equations.
At any time a system can be said to have a state. Consider a car for example, the state of the car is described by its position and velocity. Factors that are useful when identifying state variables are:
· The variables should describe energy storing elements (potential or kinetic).
· The variables must be independent.
· They should fully describe the system elements.
After the state variables of a system have been identified, they can be used to write first-order state variable equations. The general form of state variable equations is shown in Figure 4.1 The general state variable form. Notice that the state variable equation is linear, and the value of x is used to calculate the derivative. The output equation is not always required, but it can be used to calculate new output values.
Figure 4.1 The general state variable form
An example of a state variable equation is shown in Figure 4.2 Example: A state variable equation. As always, the FBD is used to develop the differential equation. The resulting differential equation is second-order, but this must be reduced to first-order. Using the velocity variable, 'v' the second-order differential equation can be reduced to a first-order equation. An equation is also required to define the velocity as the first derivative of the position, 'x'. In the example the two state equations are manipulated into a matrix form. This form can be useful, and may be required for determining a solution. For example, HP calculators require the matrix form, while TI calculators use the equation forms. Software such as Mathcad can use either form. The main disadvantage of the matrix form is that it will only work for linear differential equations.
Figure 4.2 Example: A state variable equation
Figure 4.3 Drill problem: Put the equation in state variable form
Consider the two cart problem in Figure 4.4 Example: Two cart state equation. The carts are separated from each other and the wall by springs, and a force is applied to the left hand side. Free body diagrams are developed for each of the carts, and differential equations developed. For each cart a velocity state variable is created. The equations are then manipulated to convert the second-order differential equations to first-order state equations. The four resulting equations are then put into the state variable matrix form.
Figure 4.4 Example: Two cart state equation
Figure 4.5 Drill problem: Develop the state equations in matrix form
Figure 4.6 Drill problem: Convert the system to state equations
In some cases we will develop differential equations that cannot be directly reduced because they have more than one term at the highest order. For example, if a second-order differential equation has two second derivatives it cannot be converted to a state equation in the normal manner. In this case the two high order derivatives can be replaced with a dummy variable. In mechanical systems this often happens when masses are neglected. Consider the example problem in Figure 4.7 Using dummy variables for multiple high order terms, both 'y' and 'u' are first derivatives. To solve this problem, the highest order terms ('y' and 'u') are moved to the left of the equation. A dummy variable, 'q', is then created to replace these two variables with a single variable. This also creates an output equation as shown in Figure 4.1 The general state variable form.
Figure 4.7 Using dummy variables for multiple high order terms
At other times it is possible to eliminate redundant terms through algebraic manipulation, as shown in Figure 4.8 Example: A dummy variable. In this case the force on both sides of the damper is the same, so it is substituted into the equation for the cart. But, the effects on the damper must also be integrated, so a dummy variable is created for the integration. An output equation was created to calculate the value for x 1 .
Figure 4.8 Example: A dummy variable
Repetitive calculations can be used to develop an approximate solution to a set of differential equations. Starting from given initial conditions, the equation is solved with small time steps. Smaller time steps result in a higher level of accuracy, while larger time steps give a faster solution.
Numerical solutions can be developed with hand calculations, but this is a very time consuming task. In this section we will explore some common tools for solving state variable equations. The analysis process follows the basic steps listed below.
1. Generate the differential equations to model the process.
2. Select the state variables.
3. Rearrange the equations to state variable form.
4. Add additional equations as required.
5. Enter the equations into a computer or calculator and solve.
An example in Figure 4.9 Example: Dynamic system shows the first four steps for a mass-spring-damper combination. The FBD is used to develop the differential equations for the system. The state variables are then selected, in this case the position, y, and velocity, v, of the block. The equations are then rearranged into state equations. The state equations are also put into matrix form, although this is not always necessary. At this point the equations are ready for solution.
Figure 4.9 Example: Dynamic system
Figure 4.10 Example: Solving state equations with a TI-85 calculator shows the method for solving state equations on a TI-86 graphing calculator. (Note: this also works on other TI-8x calculators with minor modifications.) In the example a sinusoidal input force, F, is used to make the solution more interesting. The next step is to put the equation in the form expected by the calculator. When solving with the TI calculator the state variables must be replaced with the predefined names Q1, Q2, etc. The steps that follow describe the button sequences required to enter and analyze the equations. The result is a graph that shows the solution of the equation. Points can then be taken from the graph using the cursors. (Note: large solutions can sometimes take a few minutes to solve.)
Figure 4.10 Example: Solving state equations with a TI-85 calculator
Figure 4.11 Example: Solving state equations with a TI-89 calculator
State equations can also be solved in Mathcad using built-in functions, as shown in Figure 4.12 Example: Solving state variable equations with Mathcad. The first step is to enter the state equations as a function, 'D(t, Q)', where 't' is the time and 'Q' is the state variable vector. (Note: the equations are in a vector, but it is not the matrix form.) The state variables in the vector 'Q' replace the original state variables in the equations. The 'rkfixed' function is then used to obtain a solution. The arguments for the function, in sequence are; the state vector, the start time, the end time, the number of steps, and the state equation function. In this case the 10 second time interval is divided into 100 parts each 0.1s in duration. This time is chosen because of the general response time for the system. If the time step is too large the solution may become unstable and go to infinity. A time step that is too small will increase the computation time marginally. When in doubt, run the calculator again using a smaller time step.
Figure 4.12 Example: Solving state variable equations with Mathcad
The simplest form of numerical integration is Euler's first-order method. Given the current value of a function and the first derivative, we can estimate the function value a short time later, as shown in Figure 4.13 First-order numerical integration. (Note: Recall that the state equations allow us to calculate first-order derivatives.) The equation shown is known as Euler's equation. Basically, using a known position and first derivative we can calculate an approximate value a short time, h, later. Notice that the function being integrated curves downward, creating an error between the actual and estimated values at time 't+h'. If the time step, h, were smaller, the error would decrease.
Figure 4.13 First-order numerical integration
The example in Figure 4.14 Example: First order numerical integration shows the solution of Newton's equation using Euler's method. In this example we are determining velocity by integrating the acceleration caused by a force. The acceleration is put directly into Euler's equation. This is then used to calculate values iteratively in the table. Notice that the values start before zero so that initial conditions can be used. If the system was second-order we would need two previous values for the calculations.
Figure 4.14 Example: First order numerical integration
Figure 4.15 Drill problem: Numerically integrate the differential equation
An example of solving the previous example with a traditional programming language is shown in Figure 4.16 Example: Solving state variable equations with a C program. In this example the results will be written to a text file 'out.txt'. The solution iteratively integrates from 0 to 10 seconds with time steps of 0.1s. The force value is varied over the time period with 'if' statements. The integration is done with a separate function.
Figure 4.16 Example: Solving state variable equations with a C program
Figure 4.17 Example: Solving state variable equations with a Java program
The program in Figure 4.18 Example: First order integration with Scilab is for Scilab (a Matlab clone). The state variable function is defined first. This is followed by a definition of the parameters to be used for the numerical integration. Finally the function is solved explicitly (with the exact function).
Figure 4.18 Example: First order integration with Scilab
Figure 4.19 Example: First order integration with Scilab (continued)
First-order integration works well with smooth functions. But, when a highly curved function is encountered we can use a higher order integration equation. The Taylor series equation shown in Figure 4.20 The Taylor series for approximating a function. Notice that the first part of the equation is identical to Euler's equation, but the higher order terms add accuracy.
Figure 4.20 The Taylor series
An example of the application of the Taylor series is shown in Figure 4.21 Example: Integration using the Taylor series method. Given the differential equation, we must first determine the derivatives and substitute these into Taylor's equation. The resulting equation is then used to iteratively calculate values.
Figure 4.21 Example: Integration using the Taylor series method
Recall that the state variable equations are first-order equations. But, to obtain accuracy the Taylor method also requires higher order derivatives, thus making is unsuitable for use with state variable equations.
First-order integration provides reasonable solutions to differential equations. That accuracy can be improved by using higher order derivatives to compensate for function curvature. The Runge-Kutta technique uses first-order differential equations (such as state equations) to estimate the higher order derivatives, thus providing higher accuracy without requiring other than first-order differential equations.
The equations in Figure 4.22 Fourth order Runge-Kutta integration are for fourth order Runge-Kutta integration. The function 'f()' is the state equation or state equation vector. For each time step the values 'F1' to 'F4' are calculated in sequence and then used in the final equation to find the next value. The 'F1' to 'F4' values are calculated at different time steps, and values from previous time steps are used to 'tweak' the estimates of the later states. The final summation equation has a remote similarity to the first order integration equation. Notice that the two central values in time are more heavily weighted.
Figure 4.22 Fourth order Runge-Kutta integration
An example of a Runge-Kutta integration calculation is shown in Figure 4.23 Example: Runge-Kutta integration. The solution begins by putting the state equations in matrix form and defining initial conditions. After this, the four integrating factors are calculated. Finally, these are combined to get the final value after one time step. The number of calculations for a single time step should make obvious the necessity of computers and calculators.
Figure 4.23 Example: Runge-Kutta integration
Figure 4.24 Drill problem: Integrate the acceleration function
Figure 4.25 Drill problem: Integrate to find the system response
The program in Figure 4.26 Example: Runge-Kutta integration C program and Figure 4.28 Example: Runge-Kutta integration Scilab program is used to perform a Runge-Kutta integration of a mass-spring-damper system. The 'main' program loops through the time steps and writes the value to a file. The 'step' function performs one timestep integration for a second order Runge-Kutta integration. It uses the functions 'add' and 'multiply' to manipulate the state matrix. The 'derivative' function updates the state matrix with the new derivative values.
Figure 4.26 Example: Runge-Kutta integration C program
Figure 4.27 Example: Runge-Kutta integration C program (cont'd)
A Scilab program is given in Figure 4.28 Example: Runge-Kutta integration Scilab program to perform a Runge Kutta integration.
Figure 4.28 Example: Runge-Kutta integration Scilab program
In most cases the result of numerical analysis is graphical or tabular. In both cases details such as time constants and damped frequencies can be obtained by the same methods used for experimental analysis. In addition to these methods there is a technique that can determine the steady-state response of the system.
The state equations can be used to determine the steady-state response of a system by setting the derivatives to zero, and then solving the equations. Consider the example in Figure 4.29 Example: Finding the steady-state response. The solution begins with a state variable matrix. (Note: this can also be done without the matrix also.) The derivatives on the left hand side are set to zero, and the equations are rearranged and solved with Cramer's rule.
Figure 4.29 Example: Finding the steady-state response
When doing experiments, data is often collected in the form of individual data points (not as complete functions). It is often necessary to integrate or differentiate these values. The basic equations for integrating and differentiating are shown in Figure 4.30 Example: Integration and differentiation using data points. Given data points, y, collected at given times, t, we can integrate and differentiate using the given equations. The integral is basically the average height of the two points multiplied by the width to give an area, or integral. The first derivative is basically the slope between two points. The second derivative is the change in slope values for three points. In a computer based system the time points are often equally spaced in time, so the difference in time can be replaced with a sample period, T. Ideally the time steps would be as small as possible to increase the accuracy of the estimates.
Figure 4.30 Example: Integration and differentiation using data points
An example of numerical integration using Scilab is given in Figure 4.31 Example: Integration with a Scilab program and Figure 4.32 Example: Integration with a Scilab Program (cont'd).
Figure 4.31 Example: Integration with a Scilab program
Figure 4.32 Example: Integration with a Scilab Program (cont'd)
When analyzing a system, we may need to choose an input that is more complex than inputs such as steps, ramps, sinusoids and parabolae. The easiest way to do this is to use switching functions. Switching functions turn on (have a value of 1) when their arguments are greater than or equal to zero, or off (a value of 0) when the argument is negative. Examples of the use of switching functions are shown in Figure 4.33 Example: Switching functions. By changing the values of the arguments we can change when a function turns on or off.
Figure 4.33 Example: Switching functions
These switching functions can be multiplied with other functions to create a complex function by turning parts of the function on or off. An example of a curve created with switching functions is shown in Figure 4.34 Example: Switching functions to create a non-smooth function.
Figure 4.34 Example: Switching functions to create a non-smooth function
The unit step switching function is available in Mathcad and makes creation of complex functions relatively trivial. Step functions are also easy to implement when writing computer programs, as shown in Figure 4.35 Example: A subroutine implementing the example in Figure 4.34.
Figure 4.35 Example: A subroutine implementing the example in Figure 4.34 Example: Switching functions to create a non-smooth function
In some cases we are given tables of numbers instead of equations for a system component. These can still be used to do numerical integration by calculating coefficient values as required, in place of an equation.
Tabular data consists of separate data points as seen in Figure 4.36 Example: Using tables of values to interpolate numerical values using the lever law. But, we may need values between the datapoints. A simple method for finding intermediate values is to interpolate with the "lever law". (Note: it is called this because of its' similarity to the equation for a lever.) The table in the example only gives flow rates for a valve at 10 degree intervals, but we want flow rates at 46 and 23 degrees. A simple application of the lever law gives approximate values for the flow rates.
Figure 4.36 Example: Using tables of values to interpolate numerical values using the lever law
The subroutine in Figure 4.37 Example: A tabular interpolation subroutine was written to return the numerical value for the data table in Figure 4.36 Example: Using tables of values to interpolate numerical values using the lever law. In the subroutine the tabular data is examined to find the interval that the flow rate value falls inside. Once this is found the valve angle is calculated as the ratio between the two known values.
Figure 4.37 Example: A tabular interpolation subroutine
When greater accuracy is required, smooth curves can be fitted to interpolate points. These curves are known as splines. There are multiple methods for creating splines, but the simplest is to use a polynomial fitted to a set of points.
The example in Figure 4.38 Example: Spline fitting shows a spline curve being fitted for three data points. In this case a second order polynomial is used. The three data points are written out as equations, and then put into matrix form, using the coefficients as the unknown values. The matrix is then solved to obtain the coefficient values for the final equation. This equation can then be used to build a mathematical model of the system.
Figure 4.38 Example: Spline fitting
The order of the polynomial should match the number of points. Although, as the number of points increases, the shape of the curve will become less smooth. A common way for dealing with this problem is to fit the spline to a smaller number of points and then verify that it matches the remaining points, or use a least squares method to find the best approximation.
Despite our deepest wishes for simplicity, most systems contain non-linear components. In the last chapter we looked at dealing with non-linearities by linearizing them locally. Numerical techniques will handle non-linearities easily, but smaller time steps are required for accuracy.
Consider the mass and an applied force shown in Figure 4.39 Example: Developing state equations for a non-linear system. As the mass moves an aerodynamic resistance force is generated that is proportional to the square of the velocity. This results in a non-linear differential equation. This equation can be numerically integrated using a technique such as Runge-Kutta. Note that the state equation matrix form cannot be used because it requires linear equations.
Figure 4.39 Example: Developing state equations for a non-linear system
As engineers we use computers to perform many calculation quickly. There is an obvious trade-off between computer cost and speed. And, of course, more precision is more costly. For example, if we are using a desktop system for the analysis of experimental data we may be able to buy an expensive computer with a high level of mathematical precision. However a microprocessor that is to be put into an automotive part must have a very low cost. Many computers have math functions built into an Arithmatic Logic Unit (ALU) core. On smaller microcontrollers this will often do integer (2s compliment) addition, subtraction, multiplication, and division. More advanced computers will include a mathematic co-processor unit that is dedicated to returning floating point numerical results quickly.
Computer based number representations are ultimately reduced to true or false values. The simplest number is a binary bit with an integer range from 0 to 1, however bits are normally grouped into some larger multiple of 8 based upon the size of the date bus (e.g., 8-byte, 16-word, 32- long word, 64). These are then used to represent numerical values over a range. For example a byte can respresent an unsigned integer value from 0 to 255, a signed integer value from -127 to 127, or a 2s compliment integer value from -128 to 127. As expected the precision and range of the number increases with the number of bits. And, by allocating a few of the bits for an exponent, the number can be used to represent large real values. Figure 4.40 Typical Number System Tradeoffs shows a very simplistic comparison of the number systems.
Figure 4.40 Typical Number System Tradeoffs
The subject of computer numbering systems is very broad and this book is not intended to teach the fundamentals of these numbering systems. But, to provide some design direction,
· If possible use 2s compliment integer calculations with 2 or 4 bytes. These will run easily on inexpensive hardware, And if used on faster computers there will be a substantial speed bonus. The problems are the limited range and loss of fractions.
· Floating point calculations are the standard on regular (non-embedded) computers. The numbers are 7 place, single precision, 4 byte numbers or 14 place, double precision, 8 byte numbers. Unless space is at a premium, use double precision. To implement these subroutines in small computers can consume large amounts of available memory and processor time.
· Fixed point numbers do not allow all of the flexibility of the floating point values, but preserve the fractional results. These are often used to get the speed or memory benefits of floating point calculations on lower end computers.
Figure 4.41 Example: Program speed based upon number system shows two subroutines that are effectively identical, except for the choice of number system. Both will loop 999 times, incrementing the index value by adding one. The print statement within the loop also requires are division and modulo operations. All three of the mathematical operations are slower for double precision. Moreover the printf statement will require more time to print the results for the floating point numbers. Overall the integer loop will probably run an order of magnitude faster.
Figure 4.41 Example: Program speed based upon number system
In the design of controls systems the execution time for a program may be critical to system stability. Or, when running large numerical calculations, small changes can save days or weeks of computer time. Each operation requires a finite number of computer CPU cycles with the number varying based upon the instruction. For example a sign change is very fast, addition and subtraction can be slower, multiplication and division slower still, and a trigonometric operation is among the slowest. If the operations are done in hardware they will be much faster. If done in software the speed will vary depending upon the compiler. It is often possible to reduce the computation time by reducing the number of slower operations. In Figure 4.42 Rearranging Expressions to Increase Execution Speed there is a simple manipulation that eliminates one addition, or a more elaborate method that eliminates one trigonometric operation. In practice this would probably reduce the calculation time by at least one quarter to a half.
Figure 4.42 Rearranging Expressions to Increase Execution Speed
Computer calculations are generally repeatable - meaning that repeating a calculation will give exactly the same result. Although this does not mean that the result is correct. For example a small error (one in a million) repeated a million times becomes significant. Considering the iterative nature of numerical calculations this scenario is likely to occur (note: not just possible). In these cases it is important to review the results with the following rules.
· Understand that the magnitude of errors increases with the number of calculations.
· Find a way to measure errors in calculations.
· Where possible correct for errors in calculations.
A common problem with floating point numbers is determining when the values are equal. Consider the values 2.00000001 and 1.99999998, for all practical purposes they are equal. But, from the standpoint of a computer they differ by 0.00000003 and are not equal. This can be overcome using a subroutine like that shown in Figure 4.43 Example: Error Allowances for Equivalences.
Figure 4.43 Example: Error Allowances for Equivalences
Consider the simplified model of a car suspension shown in Figure 4.44 Example: A model of a car suspension system. The model distributes the vehicle weight over four tires with identical suspensions, so the mass of the vehicle is divided by four. In this model the height of the road will change and drive the tire up, or allow it to drop down. The tire acts as a stiff spring, with little deflection. The upper spring and damper are the vibration isolation units. The damper has been designed to stiffen as the damper is compressed. The given table shows how the damper coefficient varies with the amount of compression.
Figure 4.44 Example: A model of a car suspension system
For our purposes we will focus only on the translation of the tire, and ignore its rotational motion. The differential equations describing the system are developed in Figure 4.45 Example: Differential and state equations for the car suspension system.
Figure 4.45 Example: Differential and state equations for the car suspension system
The damping force must be converted from a tabular form to equation form. This is done in Figure 4.46 Example: Fitting a spline to the damping values.
Figure 4.46 Example: Fitting a spline to the damping values
The system is to be tested for overall deflection when exposed to obstacles on the road. For the initial conditions we need to find the resting heights for the tire and car body. This can be done by setting the accelerations and velocities to zero, and finding the resulting heights.
Figure 4.47 Example: Calculation of initial deflections
The resulting calculations can then be written in a computer program for analysis, as shown in Figure 4.48 Example: Program for numerical analysis of suspension system.
Figure 4.48 Example: Program for numerical analysis of suspension system
Figure 4.49 Example: Program for numerical analysis of suspension system (continued)
This program was then used to test various design cases by selecting input types for changes in the road height, and then calculating how the tire and vehicle heights would change as a result. Some of these results are seen in Figure 4.50 Example: Graphs of simulation results. These results were obtained by running the program, and then graphing the results in a spreadsheet program. The input of zero for the road height was used to test the program. As shown the height of the vehicle changes, indicating that the initial height calculations are correct, and the model is stable. The step function shows some oscillations that settle out to a stable final value. The oscillation is relatively slow, and is fully transmitted to the automobile. The ramp function shows that the car follows the rise of the slope with small transient effects at the start.
Figure 4.50 Example: Graphs of simulation results
· State variable equations are differential equations reduced to first order differential equations.
· First order equations can be integrated numerically.
· Higher order integration, such as Runge-Kutta increase the accuracy.
· Switching functions allow functions terms to be turned on and off to provide more complex function.
· Tabular data can be used to get numerical values.
1. Convert the following differential equations to state variable form.
2. a) Put the differential equations given below in state variable form.
b) Put the state equations in matrix form
3. Develop state equations for the mass-spring-damper system below.
4. The system below is comprised of two masses. There is viscous damping between the masses and between the bottom mass and the floor. The masses are also connected with a cable that is run over a massless and frictionless pulley. Write the differential equations for the system, and put them in state variable form.
5. Do a first order numerical integration of the derivative below from 0 to 10 seconds in one second steps. Assume the system starts undeflected. Write the equation for each time step.
6. Given the differential equation below integrate the values numerically for the first ten seconds with 1 second steps. Assume the initial value of x is 1. You may use first order or Runge Kutta integration.
7. Write a Scilab program to calculate the area under the function below using a numerical method, such as Simpson's rule. Test it by using the range from x=1 to x=1.2. Assume the sine function is in radians
8. Write a computer program in a language of your choice (C/C++, Java, Scilab script, etc.) that will numerically integrate the differential equation below.
9. Given the following differential equation and initial conditions, draw a sketch of the first 5 seconds of the output response. The input is a step function that turns on at t=0. Use at least two different methods, and compare the results.
10. a) For the mass-spring-damper system below solve the differential equation as a function of time. Assume the system starts at rest and undeflected. b) Also solve the problem using your Scilab (and state equations) to verify your solution. Sketch the results.
11. The mechanical system below is a mass-spring-damper system. A force 'F' of 100N is applied to the 10Kg cart at time t=0s. The motion is resisted by the spring and damper. The spring coefficient is 1000N/m, and the damper coefficient is to be determined. Follow the steps below to develop a solution to the problem. Assume the system always starts undeflected and at rest.
a) Develop the differential equation for the system.
b) Solve the differential equation using damper coefficients of 100Ns/m and 10000Ns/m. Draw a graph of the results.
c) Develop the state equations for the system.
d) Solve the system with a first order numerical analysis using Scilab for damper coefficients of 100Ns/m and 10000Ns/m. Draw a graph of the results.
e) Solve the system with a Runge Kutta numerical analysis using Scilab for damper coefficients of 100Ns/m and 10000Ns/m. Draw a graph of the results.
f) Write a computer program (in C, Java or Fortran) to do the Runge Kutta numerical integration in step e). Draw a graph of the results.
g) Compare all of the solutions found in the previous steps.
h) Select a damper coefficient to give an overall system damping factor of 1. Verify the results by numerically integrating.
12. For the mechanism illustrated in the figure below the values are K s1 =K s2 =100N/m, M 1 =M 2 =1kg, F=1N. Assume that the system starts at rest, and the springs are undeformed initially.
a. Derive the differential equations for the system.
b. Put the equations in state variable form.
c. Put the equations in state variable matrices.
d. Use Scilab to find values for x 1 and x 2 over the first 10 seconds. Provide the results in a table in 1 second intervals.
e. Use Scilab to plot the values for the first 10 seconds.
f. Use a Scilab program and the Runge-Kutta method to produce a graph of the first 10 seconds.
g. Repeat step g. using the first-order approximation method.
h. Use a C program to produce a graph of points for the first 10 seconds.
13. The second order response below was obtained for a unit step input (x) to a system. Develop the state equation and find the response to a ramp input.
14. Develop the state equations and numerically integrate the following differential equation for 20s for the given input function. Show the results in a table.
15. Find the response of the following differential equation to the given step input. Assume the initial conditions are all zero. Solve the problem using a numerical method and show the values from 0 to 10 seconds in 1 second intervals.
16. Write a Scilab program to implement the following equation to calculate the value of x.
17. Numerically integrate one time step of the differential equation below using a) first order integration and b) Runge Kutta integration.
18. For the mechanism shown in the figure below the values are K s1 =K s2 =100N/m, K d1 =10Nm/s, M 1 =M 2 =1kg, F=1N. Assume that the system starts at rest, and the springs are undeformed initially.
a. Derive the differential equations for the system.
b. Put the equations in state variable form.
c. Put the equations in state variable matrices.
d. Use Scilab and first order integration to find values for x 1 and x 2 over the first 10 seconds. Provide the results in a table in 1 second intervals.
e. Use Scilab to plot the values for the first 10 seconds using the values obtained in part d.
f. Use a Scilab program and the Runge-Kutta method to produce a graph of the first 10 seconds.
g. Use a C program to produce a list of points for the first 10 seconds.
h. Compare the results found in steps d, f and g in a table.
1. Write a Scilab program to implement the following equation to calculate the value of x.
2. Write a Scilab program to implement the following equation to calculate the value of x.
3. Write a Scilab program to integrate the area under the function below using a numerical method, such as Simpson's rule. Find the area from 1 to 2.
4. Convert the third order differential equation below to state equation form. With a numerical method of your choice, find the state of the system 1 second later. Show all calculations.
5. The differential equation below describes a first order system that starts with an initial value of k=20. Find the state at two milliseconds using a) explicit integration, b) first order numerical integration and c) Runge-Kutta integration. For the numerical methods use a timestep of h=0.001s. ----> The final results must be put in a table for easy comparison.
6. Use a numerical method to find the position of the mass below over the first 2s. Record these values in a table and sketch the curve. The mass starts at rest at x=0. The block experiences aerodynamic drag that opposes motion. Assume the surface is frictionless.
7. Explicitly solve the following differential equation. Verify the result numerically.
8. A simplified model of a cam shaft driven lever is shown below.
a) Determine the equation of motion (differential equation) for the system as a function of theta.
b) Assume that L1 = 4.0cm and L2 = 10.0cm. Given an applied force of F=400N resulting in a deflection of y=-1.0cm, calculate the spring coefficient Ks.
c) Explicitly solve the differential equation to find theta as a function of time. The result should be left variable form.
d) Provide the system model as a state variable matrix.
e) Select a value for Jm that results in a natural frequency of 4Hz using the values provided in step b).
9. Given the mass spring damper system below a) develop the state equations, and b) estimate the steady state response. Consider gravity.
10. Write the differential equations AND state equations for the systems below.