



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




BAE 200 Week 5 Lecture notes: 9/23/
Matrix Concepts and MATLAB Matrix Computations (Engineering Analysis and MATLAB 7 - Chapter 5 p 92-100, Chapter 6 p 142-145, Chapter 9 p 247-260, Chapter 10 276-278)
MATLAB Linear Interpolation (Engineering Analysis and MATLAB 7 - Chapter 11 p. 291-299)
Topics:
-We have spent the first four weeks developing engineering problem solving methods, building a foundation of programming concepts, and developing your foundation of MATLAB skills
Lets review what we have learned about the MATLAB matrices we have been using during our programming thus far: Chapters 5, 6, and 8
x=[2,4,6,8;10,12,14,16;18,20,22,24]
x = 2 4 6 8 10 12 14 16 18 20 22 24
x(5) %can get a value from a particular location ans = 12 x(5)=100 % can replace a value with another number x = 2 4 6 8 10 100 14 16 18 20 22 24 o How about in an equation? y= x(5)* y = 50000 o Can use this in outputting data as well
fprintf ('this example should output x(5) %4.3f',x(5)) this example should output x(5) 100.
Time savers and commands o Evenly spaced vector time saver B=1:5 or B=[1:5] (colon separator) o If you want them spaced a certain way time = 0:2:100 gives a vector between 0 and 100 in steps of 2 o linspace - used if you want a certain amount of elements between 2 numbers
r=linspace(0,14,5) r = 0 3.5000 7.0000 10.5000 14.
This system of equations can be written as AX=B. Simplify by replacing x with x 1 , y with x 2 , and z with x (^) 3. 3 x1 + 2 x 2 - x3 = 10
Replacing the coefficients with A and B yields:
31 1 32 2 33 3 3
21 1 22 2 23 3 2
11 1 12 2 13 3 1
A x A x A x B
A x A x A x B
A x A x A x B
can be written in matrix form as:
3
2
1
3
2
1
31 32 33
21 22 23
11 12 13
B
x
x
x
or in matrix notation as AX=B.
Replacing the numerical coefficients yields:
3
2
1
x
x
x
A = the 3x3 matrix, X = the column vector x 1 ,x2,x3, and B = the column vector 10,5,
MATLAB can solve this for x 1 , x2 , and x 3! We will discuss this in lab!
Chapter 9 Mathematical Operations with Arrays - we need to be familiar with these
These operations between Arrays can be different than standard arithmetic operations. Scalars can be added, subtracted, multiplied and divided into matrices according to standard operations x =
2 4 6 8 10 100 14 16 18 20 22 24
5*x
ans =
10 20 30 40 50 500 70 80 90 100 110 120
5+x
ans =
7 9 11 13 15 105 19 21 23 25 27 29
5/x ??? Error using ==> mrdivide Matrix dimensions must agree.
x/
ans =
0.4000 0.8000 1.2000 1. 2.0000 20.0000 2.8000 3. 3.6000 4.0000 4.4000 4.
31 11 32 21 33 31 31 12 32 22 33 32 31 13 32 23 33 33
21 11 22 21 23 31 21 12 22 22 23 32 21 13 22 23 23 33
11 11 12 21 13 31 11 12 12 22 13 32 11 13 12 23 13 33
31 32 33
21 22 23
11 12 13
31 32 33
21 22 23
11 12 13
Example of raising a matrix to a power
x =
2 4 6 8 10 100 14 16 18 20 22 24
x^
??? Error using ==> mpower Matrix must be square.
x.^
ans =
4 16 36 64 100 10000 196 256 324 400 484 576
In lab today - will discuss solving simultaneous equations using matrix operations, the SOLVE Function, and interpolation