**No TK Solver in MAE 325. **The
text by Norton uses TK-Solver which is not commonly known on the Cornell campus
nor outside.

**Matlab
is used in MAE 325.** All MAE 325 computation is with MATLAB which
is commonly known on the Cornell campus and used widely in industry.

**Matlab is available.** Matlab
is available at all Engineering public facilities. Engineering students can
get a password from the engineering library. The student version can be purchased
at the campus store.

**You are already comfortable using
MATLAB.** To some extent or another, Matlab is in CS100, Math293 and 294,
TAM 203, and in many other courses.

**MATLAB on exams. **Matlab commands
that, if executed, would generate a solution will be acceptable as exam solutions.
Some exam problems will only by solvable this way.

**More MATLAB help. **First you
should learn how to use all the different kinds of online help. Next, get a
good book. Getting Started With Matlab 5 by Pratap is pretty good. Spend 8 hours
slowly doing the tutorials therin and you will be ready to go. Some course relevant
Matlab samples may appear on this page as the semester progresses.

Here are several tips and some example M files which show various ways how linear and nonlinear equations can be solved with MATLAB. Put the examples in M files and run them to see how they work.

**Solving systems of linear algebraic equations.**For example, here are some linear algebra equations you may want to solve.

3* x1 + 5* x2 + 2* x3 = 3

x1 + 7* x3 = 2

x2 + 3* x3 = 5

The following three example files all depend on rewriting the equations in the form of Ax = b and then using backslash in MATLAB (i.e. x = A\b). But these files are slightly different in the way the A matrix is assembled and in how the output is expressed- linear_1.m : define A matrix fully, element by element.
- linear_2.m : predefine A matrix as zero matrix and then set non-zero elements of A.
- linear_3.m : Here the output is expressed as 'variable name = variable value' instead of 'x1= ..., x2=...'. This one is more fancy and only here for people who are interested.
- The solve command
described below can also be used to solve linear equations, although we
do not recommend it.

**Nonlinear equations of 1 variable.**For example, find x given that

0.1*e^x + sin(x) - 5 = x.

The following four example files show the different approaches to solve this problem.- nonlin_onevar_1.m : Express equations in homogeneous form (i.e. f(x)=0) and plot f(x) versus x to see which values of x approximately satisfy the equations. Then zoom in on the plot to find x more accurately. This method can not give the exact solution but provides a rough idea what the solution is.
- nonlin_onevar_2.m : Express equations in homogeneous form (i.e. f(x)=0) and use Matlab's 'fzero' function.
- nonlin_onevar_3.m : Express equations in homogeneous form (i.e. f(x)=0) and use 'fsolve' function. Note : fsolve is not available with the MATLAB student version. But it is available in the College facilities.
- nonlin_onevar_4.m : use the
symbolic 'solve' function (available with the student edition).

**Nonlinear equations of several variables**- nonlin_multivar_1.m : using the symbolic solve command.
- nonlin_multivar_2.m : using the fsolve command (not available with student version)
- nonlin_multivar_3.m : use our own maesolve command. The 'maesolve' command will bewritten by us to replace the Matlab fsolve command that is not available in the student version. Do you want to write it for extra credit? Contact us and we will give the specs.

**Four Bar Linkage Kinematcs**

These are the functions explained in lecture on Wed September 22. They are not well documented since they were explained line by line in lecture.

law_cos_ang.m

law_cos_len.m

linkage_vec.m

linkage_pos.m

linkage_ag.m

cross_2d.m