ENGR_141_Week_2-3_-_Algorithms,_Matrices,_Programs,_Functions_S08[1]

ENGR_141_Week_2-3_-_Algorithms,_Matrices,_Programs,_Functions_S08[1]

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon
A LGORITHMS , M ATRICES , P ROGRAMS , & F UNCTIONS January 14, 2008
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A LGORITHMS Simple sequences of instructions Can take many different forms oral directions written recipes pictorial assembly instructions video on how to install computer parts symbolic street signs or lights
Background image of page 2
O RAL A LGORITHMS ? Simon says… stand up Simon says… raise your right arm Raise your left arm
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
G RAPHICAL : L EGOS
Background image of page 4
G RAPHICAL : T RANSPORTATION
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
W RITTEN A LGORITHMS
Background image of page 6
H OW D O E NGINEERS D EVELOP A LGORITHMS ? Written: Documentation: developing a materials list, developing and documenting a sequential process “Pseudocode”: A combination of written directions and computer code (Eg. Count the number of students and measure their heights. Average height = sum of heights / total number of students) Writing code: MATLAB, C, C++, etc… Graphical: CAD drawings: Solid Edge, AutoCAD Flowcharting: Graphical representation of a sequential process
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
F LOWCHART FORMATTING Pictorial algorithms Rectangles represent actions / modules input, calculation, output Diamond-shapes are decisions Text in boxes can include “pseudocode”— similar to what you would type in Matlab Must include a box for the END
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
M ICROSOFT W ORD 2007
Background image of page 10
E Enter race conditions Input the following values: Set Samstart = Sam’s head start [ft] Set Samspeed = Sam’s speed [ft/s] Set other race conditions Set Marystart = 0 [ft] Calculate race results Marytime = (length – Marystart) / Maryspeed Samtime = (length – Samstart) / Samspeed
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
E XAMPLE : R ACE R ESULTS ( CONTINUED ) We’ve just computed the time each runner finishes How can we tell who wins?
Background image of page 12
E ( End YES Print ‘Sam wins!’ Is Marytime > Samtime? YES Print ‘Mary wins!’ Print ‘It’s a TIE!’
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
M ATRIX A RITHMETIC
Background image of page 14
M ATLAB IS THE M AT RIX L AB ORATORY Matlab’s building block is the matrix Matrix terms and dimensions specified by row and column [m x n], as A(1,2) numbers are [1 x 1] matrices number of elements in the matrix is (m)(n) 6 5 4 3 2 1 6 5 4 3 2 1 12 11 10 9 8 7 6 5 4 3 2 1
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
V ECTOR PRODUCTS Vector product (or “dot” product) the sum of the product of corresponding terms the product of a vector with itself is its magnitude squared A = [x , y] [x , 0] [0 , y]
Background image of page 16
V ECTOR PRODUCT BA = ad + be + cf (a scalar) f e d c b a BA c b a B f e d A
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 18
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 45

ENGR_141_Week_2-3_-_Algorithms,_Matrices,_Programs,_Functions_S08[1]

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online