User:Eml4500.f08.group.cady

'''THIS PAGE IS OBSOLETE: PLEASE GO HERE! User:Eml4500.f08.group'''


 * Matlab is here: User:Eml4500.f08.group/Matlab
 * Homework 1 is here Eml4500.f08.group/Homework1

=Finite Element Analysis=

Course Information

Website - www.mae.ufl.edu/~vql → "teaching" → "my course website" → "EML 4500 Finite Element Anslysis and Design" EML 4500 Course website Password: fall08.wiki

MWF Period 8 (3:00-3:50PM), FLG 270 Office: NEB135

Course Content

Finite Element Analysis (FEM) makes solving partial differential equations (PDEs) convenient.

The emphasis of the course will be to understand the mechanics, formulate problems, judge solution correctness, and avoiding ad-hoc structural analysis methods.

The plan of the course is to maintain confidentiality while using large-scale peer-to-peer domains including Wikiversity and MIT's OpenCourseWare in addition to the textbook. The course will examine the method of work instead of other approaches and such as e-learning and the old approach to EML4500 (10% HW and 30% x 3 for each exam). This format allows students to be introduced to Media Wiki and stimulate collaboration between students with other students, teams, the professor, and the class as a whole.

There are several relevant time zones important to us (UTC, EDT, and EST). HW will be turned in according to the UTC time to maintain consistency with the Wikipedia time stamp format.

HW shortcuts should be created by attaching the URL from the archived version by going to "History" → click on the date to open archived version → copy this address to submit

=Chapter 4: Trusses, Beams, and Frames=

Trusses
The image below is a two-truss system with elastic (deformable) bars.



Global node numbers are denoted by circles while element numbers are denoted by triangles. The elements are separable members of a system which can be individually analyzed. Nodes are points on a system on which forces appear. The x-y coordinate system can be located in any rotation about the z-axis, however in this case the y-axis is chosen to be parallel to the applied force P. Furthermore, the triangles beneath nodes 1 and 2 denote that the node displacement is fixed to zero in both the x- and y-direction.

Forces acting on the system are shown below with a systematic example of how to name the forces on the member. The names given to each of forces are arbitrary, but must be systematic and consistent.

Forces acting on the system are shown below with a systematic example of how to name the forces on the member. The names given to each of forces are arbitrary, but must be systematic and consistent.



The R1 and R3 forces can be replaced with two forces instead of four that act along the line of the trusses. Taking the moment about node 2 equal to zero, gives no conclusion because both R1 and R3 forces run through the node. The figure then has two unknown reactions, and only two equations of equilibrium (the sum of forces about the x- and y-axes. This means that the system is statically indeterminate (equations of statics cannot be used to solve R1 and R3.

To examine the forces, the system can be split into two independent bar elements.

Bar element 1:



This picture is another example of how to name the forces, nodes and elements in a systematic manner, rather than a rigid, consistent manner. The element number is denoted by a triangle again. The local nodes (nodes relative only to the specific FBD section) are denoted by squares as opposed to the global nodes (nodes relative to the entire structure) which are circled. The subscript of the forces are the degrees of freedom (dof) or internal force of the element. Each force is a separate degree of freedom and should have their own number. Also they are numbered in a consistent order: x-, y-, x-, y-axis. The superscript represent the element number in parentheses. For this global system, the dof's are 1, 2, 3, and 4 and the element numbers are 1, 2, which come to eight total numbers in both elements.

Bar element 2:



Force Displacement (FD) Relation


The diagram above shows the relationship between force and displacement in a spring with one end fixed. It both ends are free, the case becomes as follows.

Because there are now two independent variables, the spring must be analyzed with a matrix form of F = kd. Matrices are names by "row x column"



\begin{pmatrix} f_1 \\ f_2 \end{pmatrix}_{2x1} = \begin{bmatrix} k & -k \\ -k & k \end{bmatrix}_{2x2} \begin{pmatrix} d_1 \\ d_2 \end{pmatrix}_{2x1} $$

There are 2 cases which can be examined:

Case 1 is the result with respect to node 1:

$$f_2 = k (d_2 - d_1)$$

Case 2 is the result with respect to node 2:

$$f_1 + f_2 = 0$$

→ $$f_1 = -f_2 = -k (d_2 - d_1) = k (d_1 - d_2)$$

Steps to solve simple truss system
Steps to solve simple truss system described on Wed, 3 Sep 08. (Recipe)

Global picture
(description) at structure level
 * Global degrees of freedom (disp coeffs)
 * Global Forces

Actually the displacement degrees of freedom are partitioned into Simularly for the global forces
 * A known part, eq, fixed defs, constraints
 * an unknown part, solved using FEA
 * a know part: applied force
 * an unknown part: reactions

Element picture
either in global coord system on in local coord system
 * element degrees of freedom
 * element forces

Global Force Displacement relationship

 * Elemenet Stiffness matrix in global coord
 * element force matrices in global coord.
 * Assembly of element stiffness matrix and element force matrix into a global Force Displacement relationship

Elimination of known degrees of freedom
Elimination of known degrees of freedom to reduce the global Force Displacement Relationship (stiffness matrix non-singular => invertible)
 * m = number of unknown displacement degrees of freedom
 * n = number of known and unknown and displacement degrees of freedom

Kbar non singular => Kbar^-1   (Kbar invertible)

Compute Element forces
Compute Element forces from now known dbar => element stresses

Compute Reactions
Compute reactions (unknown forces)

Example
Take a specific example to see how the recipe works (no justification yet)

Element Length - L(1) = 4, L(2) = 2

Youngs Modulus - E(1) = 3, E(2) = 5

Cross Section Area - A(1) = 1, A(2) = 2

(Had to leave class here)

=Mon, 8 Sep 08=

2.) Element Picture

3.) Global Force Displacement at element level



k is the element stiffness matrix for element e

d is the the element displacement matrix

f is the element force matrix

Matrix p 225 book, 2nd equation form the bottom





axial stiffness of bar elem "e". e = 1,2

l^(e), m^(e) = director cosines of ~x axis (goes from [1] to [2]) with respect to global (x,y) coords


 * {| class="toccolours collapsible collapsed" width="60%" style="text-align:left"

!Contribution title, from team group
 * Text
 * }
 * }

=MATLAB Primer=

Accessing MATLAB
MATLAB can be accessed in a variety of ways. For example, most systems can access MATLAB by using the “matlab” system command. Similarly, MATLAB can be shut down using the internal MATLAB command of “quit” or “exit”. Since a MS Windows operation system is being used, MATLAB is accessed through the Windows start menu and closed via the red “X” icon in the upper right corner of the open MATLAB window.

Again, since Windows is being used, it will be convenient to keep both MATLAB and a text editor open in separate windows. Reasons for this will be discussed in section 14 (Managing M-files).

Entering matrices
MATLAB functions via the use of rectangular matrices. Numbers, vectors, and variables can all be represented as a matrix with numbers coming in the form of a 1x1 matrix, vectors as 1xN / Nx1, and variable as an NxN matrix (N = 1,2,3…). Matrices can be generation by built in MATLAB functions, loaded from document files or external data files, and be entered directly as a list of elements. For example, typing

A = [1 2 3; 4 5 6; 7 8 9]

into MATLAB generates a 3x3 matrix of numbers assigned to variable A.

MATLAB also accommodates the use of imaginary numbers in calculations. Complex matrices can be entering in one of two ways. Entering A = [1 2; 3 4] + i*[5 6; 7 8] or                                                                    A = [1+5i 2+6i; 3+7i 4+8i]

will generate the same complex matrix. The variable i and j denote complex values in MATLAB. New complex variable may be generated by entering ii = sqrt(-1)

into MATLAB. This will assign the variable ii equal to an imaginary number thus allowing for its use as a complex variable.

Loading large arrays into MATLAB is best accomplished by utilizing as ASCII file from a text editor. This file should consist of a rectangular array of matrix values. This file can then be loaded into MATLAB with the command “load file.ext” where file is the name of the file and .ext if the file extension.

Three built in MATALB commands can be used to generate matrices. Entering rand(n) or rand (m,n) will create a (n x n) or (m x n) matrix of random numbers. The magic(n) command will create a (n xn ) matrix in which all columns, rows, and diagonals have the same sum. Finally hilb(n) will create a (n x n) Hilbert matrix.

Individual matrix numbers can be accessed by entering A(2,3)). This command will find the numerical value assigned to the second row of column three in matrix A.

Matrix operations, array operation
There are several matrix operations that are available for use in MATALB and they apply to both matrix and scalar operations. Should there be incompatibilities in the size of the matrices to be operated on, an error message will result. The following are available matrix operators. +	addition -	subtraction *	multiplication ^	power ‘	conjugate transpose \	left division	(where x = A \ b is the solution to A * x = b)                             /	right division	(where x = b / A is the solution to x * A = b)

Some of the above matrix operations do not operate entry-wise. The ones that do not (*, ^, /, and \) can be made to operate entry-wise by preceding them with a period.

Example: [1,2,3,4] .* [1,2,3,4] or [1,2,3,4].^2 = [1,4,9,16]

Statements, expressions, variables; saving a session
MATLAB is an expression based language where expressions are composed of operators, and variable names. These expression usually take the form of “variable = expression.” The resulting matrix is then displayed on the screen and assigned a variable. Should no variable be assigned by the used, a standard variable of ans (answer) is assigned to the matrix.

Statements usually terminate at the end of a single line. In the case that a longer statement is necessary, three periods (…) followed by pressing return will continue the statement onto the next line. Conversely, several statements can be placed on a single line of code provided that each expression is separated by commas or semicolons. By placing a semicolon at the end of a line, the expression is evaluated but not printed to the screen.

It is important to note that MATLAB is case sensitive i.e. the variable “A” is not the same as variable “a”. Should it be necessary, typing the command “who” will list are current variable in the workspace and any variable may be removed by typing “clear” followed by the variable name that the user wishes to clear. Infinite loops can be broken by pressing “ctrl-break” on the keyboard

All data and variable names are lost whenever MATLAB is exited unless the save command is used. Using this command will restore the workspace to its previous version the next time MATALB is opened.

For Loop
For loop syntax example, to produce a certain n-vector for a given n:

x = []; for i=1:n, x=[x,i^2], end

or can be written:

x = []; for i= 1:n x = [x, i^2] end


 * Note: x = [] creates an empty matrix

The for statement permits any matrix to be used instead of 1:n. The variable consecutively assumes the value of each column of the matrix. The following example shows this syntax as it sums all the entries of matrix A by adding its column sums. s = 0; for c = A s = s + sum(c); end

While loop
General form:

while relation statements end

The statements will be repeated continuously while the relation is true. Once the relation is no longer true the loop ends.

An example for a given number a, will compute and display the smallest nonnegative integer n, such that 2^n >= a:

n = 0; while 2^n < a 	n = n + 1; end


 * Note: The semicolon after the statement keeps the values of n from printing on screen until after the loop is over and then the program calls to print n on the screen.

If statement
General form:

if relation statements end

The statements are executed only if the relation is true.

Multiple branching is also possible as shown in the following example:

if n < 0 parity = 0; elseif rem(n,2) == 0 parity = 2; else parity = 1; end

Relations
The relational operators in MATLAB are:


 * Note: = is used in an assignment statement while == is used in a relation

Relations may be connected or qualified by the following logical operators:

When applied to scalars a relation is just the scalar 1 (if true) or 0 (if false). Similarly for matrices of the same size a relation is a matrix of 1’s or 0’s. When a relation between matrices is interpreted by a while or if to be true each entry of the relation matrix must be nonzero.

Examples:
To execute statement 	when matrices A and B are equal:

if A == B        statement end

To execute statement when A and B are not equal:

if any(any(A ~=B)) statement end

Or

if A == B else statement end


 * Note: The above example does not work with the syntax:

if A ~= B, statement, end

This will not give the intended result because statement would only execute if each of the corresponding entries of A and B differ.

Scalar functions
A scalar function is one whose range is one dimensional and is made up of one or more variables. In MATLAB scalar functions generally operate on scalars, but will operate element-wise on matrices. some of the more common functions are:

Vector functions
A vector function is one whose range is three or n-dimensional. In MATLAB these functions generally operate on a vector. When applied to matrices in a column-by-column fashion to give you a row vector. If row-by-row action is desired it can be generated using the transpose. Some of the more common of these functions are:

Command line editing and recall
Editing the command line is very simple in MATLAB. Positioning of the cursor can be done with the left and right arrows. Backspace and Delete can be used to remove characters to the left and right of the cursor respectively. Edits can also be made to previous commands by using the up and down arrows to scroll through the commands to find the one you wish to edit and execute again. These edits work best for small projects and revisions.

Submatrices and colon notation
Colon notation is used to produce vectors and to reference submatrices. Colon Notation in addition to subscripting by key vectors are necessary to effectively manipulate matrices. They can also be used in place of loops to make the code more readable and simple. The formula for the colons is initial value: increment: terminating number. An example of this is: The Incrementing value can also be left out, causing the default of one o be used, such as: Colon Notation can be used to obtain submatrices of a matrix. An example of this is:

M-files: script files, function files
“M-files” are an integral part of MATLAB as they are files which can execute a sequence of statements stored in diskfiles – they are designated by the extension “.m” appended to the end of the filename. “M-files” can be broken down into two distinct forms: script files and function files.

Script files:

Script files are “M-files” which can contain a number MATLAB commands which can be executed by calling the script file by name. The advantage of a script file is evident; a single MATLAB command will actually execute a series of previously developed commands. Script files can be used to easily input data into a function, such as a matrix, which can help reduce entry errors. It is important to note that script file variables are global; and, the effect of the global variables contained in script files is that variables of the same name in the current MATLAB window will be altered by running the script command.

Function files:

Function files are another type of “M-file” similar to a script file, but allowing for (in certain ways) more control over how MATLAB handles an occurrence of this file type. Function files allow users to create their own functions in MATLAB, which can be used as any ordinary MATLAB function would (such as how “sqrt” is a MATLAB function that takes the square root of a number or of the value of a variable). A key difference between function files and script files is that variables in function files can be made either global or local – meaning that local variables can be created that pertain only to the function file (and thus a variable with the same name in a current MATLAB session would be unaffected by a call to the function file).

17 Hard copy
Command:  filename

This command pulls up the hardcopy and copies the content excluding graphics to that file, and will go to a default file if no filename is given. It continues to copy to the file until you command it to  or.

18 Graphics
MATLAB plots curves, 3D plots of curves , #D mesh surface plots , and 3D faceted surface plots. allows you to preview these features.

Planar plots
The command  creates an x-y plot as shown below the format for the range is 'lower rang:meshsize: upper range'.

Figures can be suppressed or exposed as the "current" figure by the command according to its figure number, and command   will give you the number of the current figure.

To make graphs, first put a function in an M-file then command it open with a domain:

Parametric graphs can also be defined as shown:

To enter text in the graph, follow these commands:

title of graph x-axis label y-axis label text on graph (placement defined by mouse) text position at specific coordinates places grid on the graph axis limits makes standard axis for all graphs auto-scaling shows current scaling for vector v puts same scale on both axes puts same scale and tic marks on both axes turns off both axis scaling and tic marks turns on both axis scaling and tic marks

Put the  commands after the   command.

To make multiple plots on a graph the format may be one of the two as follows

You can also command  to freeze the current plot and from there superimpose another plot on the same graph. This can be turned off with. To make line types use the codes: solid(-), dashed (--), dotted, dashdot (-.). To make marktypes, use the codes: point(.), plus (+), star (*), circle (o), x-mark (x). To make colors, use the codes: yellow(y), magent(m), cyan(c), red(r), green(g), blue(b), white(w), black(k). An example is a green dotted line:.

Several other features are:

Graphics hardcopy
To send the graphics to the printer, command, while   filename saves the figure to the specified format or to a default format if not specified.

3-D line plots
An example format of a 3-D line plot is as follows:

A 3-D graph has all the same commands plus.

3-D mesh and surface plots
3-D mesh plots shows a plots of matrix z with the command. A surface plot is controlled by. To obtain a mesh graph of a function over a rectangle, an example is as follows:

The shading can be  and are entered after the   command. Color profiles may be:.

Handle Graphics
To see a more complete list of the options to control a graph enter  and.