**Unformatted text preview: **ENGR 1181 Autumn 2015 | Final Exam Study Guide and Practice Problems Disclaimer Problems seen in this study guide may resemble problems relating mainly to the pertinent homework assignments. Reading this study guide and solving the practice problems is not a sufficient level of studying for this exam. Students should also review the relevant reading material and PowerPoint slides as questions will be asked from those places as well. There are six "Show Your Work" practice problems, but there are only two "Show Your Work" problems on the Final Exam. Exam Specifications 50 Points Total ‐ 20 points multiple choice (10 questions, 2 pts. each) o Done on Carmen using the "Lockdown Browser Lab" o No other internet access is allowed. Those accessing the internet otherwise will be sent to COAM. Please review OSU’s policy on academic misconduct. o Graded automatically on Carmen – your score will not be calculated until after the exam is over. ‐ 30 points – 2 "Show Your Work" problems ‐
‐
‐
‐ o All problems will be done in MATLAB and you will create the script files or work from a seed file. Always start your script files by displaying your name, seat number etc. and using close all, clear, clc o Make sure you assign a different name for each PDF file during the exam. o If you test your script file in sections using "%% ‐ ‐ ‐ ‐ ‐ ", save all changes before you hit the "Run Section" button. Calculators are not allowed. The exam is closed book closed notes. No communication with other students is allowed. Please review OSU’s policy on academic misconduct. No use of cell phones. Print your problem solutions (Script File + Command Window) to a PDF and Save the PDF on your Z:Drive. Name: Seat Number: __________ Final Exam Content Review Below are content and learning objectives that will be tested on this exam. Not all learning objectives will be tested exactly as read, however students should use this material to keep track of what they need to review and understand. 1. MATLAB a. Array Creation i. [a, b, c ; d, e, f] notation ii. [min : step : max] notation iii. linspace function iv. I/O Associated learning objectives Demonstrate proper usage of basic MATLAB features (e.g., the Command Window, script files, other default windows, arithmetic operations, assigning variables and names, built‐in functions, help command) Demonstrate proper notation for accessing elements from previously assigned one‐
dimensional arrays (e.g., single elements, list of elements) and two‐dimensional arrays (e.g., those with rows and columns) b. Array Accessing i. Pure array accessing ii. Sub arrays iii. Using the colon operator Associated learning objectives Demonstrate proper notation for accessing elements from previously assigned one‐
dimensional arrays (e.g., single elements, list of elements) and two‐dimensional arrays (e.g., those with rows and columns) Explain that a string is a one dimensional array and can be used the same way as numeric arrays c. Array Operations (“.” Operators) Associated learning objectives Explain meaning of element‐by‐element operations Identify situations where the standard operators in MATLAB (when used with arrays) are reserved for linear algebra, which is not always element‐by‐element Apply dot operators for o The six cases where linear algebra is not element‐by‐element and therefore dot operators are needed to produce element‐by‐element calculations Name: Seat Number: __________ d. MATLAB algebra syntax (conversion from math expression) Associated learning objectives Explain meaning of element‐by‐element operations Identify need to translate mathematical notation into proper MATLAB syntax e. Conditional Statements and logical operators Associated learning objectives Explain how conditional statements (e.g., if‐end, if‐else‐end, switch‐case) are used to make decisions Apply logical operations correctly in arrays Analyze data using logical operators. f. MATLAB looping Associated learning objectives Use more complex ways of setting the loop index Use loops to repeat a code with conditional statements g. Functions Associated learning objectives Demonstrate the proper use of functions in programs Explain how functions can be used in multiple places and as an organizational tool Describe purpose and structure of a function definition line Integrate user‐written functions into the same file with the main program Identify good function conventions, (e.g., the importance of placing functions at the end h. Plotting Associated learning objectives Create 2D plots in MATLAB with good graphing conventions (e.g., legend, linestyles, title, multiple plots on same graph) Create other 2D graphing options in MATLAB (e.g., log, bar, subplot, fplot) Select the proper opportunities to utilize aforementioned 2D graphing options i. Other Associated learning objectives Perform simulations using MATLAB programming skills that have been learned thus far Identify the limitations of computer based solutions Name: Seat Number: __________ Illustrate how the real‐world responds to the development of and limitations of computer solutions 2. Labs a. Quality and productivity Associated learning objectives Describe how an engineer can help enhance productivity, speed, quality, cost and sustainability in the manufacturing process. Identify the core, fundamental principles of Lean (eliminating waste) and Sigma (reducing variation in the product). Explain the fundamental difference between PUSH and PULL systems on the assembly line. b. Circuits Ohm’s law Series and parallel resistors Voltage drop Associated learning objectives Recognize and assemble series and parallel circuits. Construct electric circuits using a breadboard. Demonstrate how voltage, current and resistance are measured. Identify and use Ohm’s Law, Power Law, Kirchhoff’s Current Law and Kirchhoff’s Voltage Law. Calculate and measure the equivalent resistance of electric circuits. Employ the proper circuit configuration for a given scenario. c. Solar Meter Associated learning objectives Describe and build both a calibration and solar meter circuit Convert decimal values to binary values Compare a pictorial image of a circuit to a schematic wiring diagram d. Solar Cell Associated learning objectives Identify the advantages and disadvantages of solar cells. Calculate the efficiency of a solar cell. e. Beam Bending Associated learning objectives Employ the concepts of stress, strain, and Young's modulus for structural materials. Use the stress‐strain equation to calculate how applied forces deform structures. Calculate the moment of inertia of various beam geometries. Name: Seat Number: __________ Determine how beam geometry affects the stiffness and strength of beams. Identify unknown beam material through analysis and calculation of Young’s Modulus. Evaluate behavior of various beams based on material and shape. f. Wind Turbine – part A Associated learning objectives Describe the relationship between velocity (of the wind) and pressure based on Bernoulli’s Equation for incompressible flow. Calculate the power available in the wind and compare it to the power generated by a wind turbine. Summarize the characteristics of the wind tunnel and turbine. Describe the relationship between velocity (of the wind) and pressure. Determine the power available in the wind. Relate the power available in the wind to the wind speed. Compare the power generated by a wind turbine to the power in the wind. g. Train Project Associated learning objectives Use train project functions to program train and gate motions Use "Flags" to solve timing and logic problems typical of the train project Solve complex train project problems involving previously used concepts Apply knowledge of “tic” and “toc” to solve problems in real‐time programming Here is a syntax guide for help in reviewing. PRINTING AND BRINGING THIS TO THE EXAM IS NOT ALLOWED. MatLab Syntax Review Sheet – FOR MIDTERM 2 RELEVANT INFORMATION ONLY Current Directory – your current working directory with a list of m‐files Workspace – current list of MatLab variables and values Command History – past commands that have been typed and executed Command Window – where commands can be entered Editor Window – where you write and run MatLab script files Type "help (keyword)" in the MATLAB command window in order to find help for the "Show Your Work" problems! Name: Seat Number: __________ MatLab Tips and Syntax >> clc clear command window; does not clear memory >> cmd displays the result of a command in the command window >> cmd; does not display the result in the command window >> cmd1, cmd2 displays both results >> cmd1; cmd2 displays last result only clear clears ALL variables from memory clear x,y,z clears only x, y, and z variable names 2. must begin with a letter 3. are case sensitive contain letters, numbers, and _ math precedence ... (ellipsis) highest → ( ) ; ^ ; * / ; + ‐ ← lowest 4. extends a command to the next line up arrow ↑ scrolls backward through previous commands down arrow ↓ scrolls forward through commands help abcd help on the subject "abcd" ( doc abcd ‐‐ works too ) Numeric Display Formats format short nnn.1234 format long nnn.12345678901234 (14 decimal places) format short e n.1234e+001 format bank nnn.12 Input / Output Commands disp( ' any text ' ) displays ' any text ' in the command window fprintf('Text = %i,%f',k,x) formatted output – prints "Text = integer and fixed point" x = input( ' any text ' ) asks the user to enter a value for x from the keyboard 1‐D Array (row and column vectors) scalar, s is a single number (a 1 x 1 array) vector, v is a 1 row x n column array a list of numbers v_list = [ a b c ] or = [ a , b , c ] row vector v_row = [ a b c ] or = [ a , b , c ] Name: Seat Number: __________ column vector v_col = [ a ; b ; c ] constant spacing v_space = [ first : space : last ] single spacing v_1space = [ first : last ] vector with n terms, evenly spaced v_nterms = linspace( first, last, n ) transpose of a vector v_col = v_row ' value of the ith term v(i) Addition / Subtraction z = x y z = [ Multiplication / Division z = x .* y and z = x . / y Exponents z = x .^ y z = [ max(v) or min (v) Returns largest / smallest element of v length(v) Returns the length (# of elements) in vector v mean(v) or sum(v) Returns average value / sum of elements in v , .^ , , .^ , . 2‐D Array (matrix) Matrix, A is an r (rows) X c (columns) array A( r, c ) is the value of the element ( r, c ) in A A( r, c ), in rows A = [ row1 ; row2 ; row3 ] A( r1:r2, c1:c2 ) retrieves values in row and column ranges Example: A(1:3, [1 4 6]) means rows 1‐3 and columns 1,4,6 of matrix A Logic – Conditional and Relational Operators Less than / Greater than < / > Less than equal to / greater than equal to <= / >= Equal to / Not equal to == / ~= TRUE statement / FALSE statement 1 (or any non‐zero number) / 0 & AND ( Example: A & B ) TRUE when A and B are both true | OR ( Example: A | B ) TRUE when either A is true or B is true ~ NOT ( Example: ~ A ) TRUE if A is false / FALSE if A is true Operator precedence ( high low ) ( ) ^ ~ */ +– > < >= <= == ~= & | Name: Seat Number: __________ Conditional Statements if conditional statement Works when there is only one command group Command Group end if conditional statement If the conditional statement is "True", then do "Command Group 1". Command Group 1 It the conditional statement is "False", then do "Command Group 2". else Command Group 2 end if ( conditional 1 ) "If – elseif – else – end" do Command Group 1 elseif ( conditional 2 ) When there are more than two command groups, you can use this form with elseif do Command Group 2 Elseif = if not the first, do the second, or if not the second, do the third, etc. elseif ( conditional 3 ) do Command Group 3 else The "else" never has a conditional and is optional. do Command Group 4 end Loops k = first : step : last Loop index variable = first value : step size : last value Example of a loop in a script file: v1 = [ 0 : 5 : 25 ] ; % Define the vector v1 for i = 1 : length (v1) % The step size is 1 This loop calculates a new vector v2 from an existing vector v1. Note that the loop uses vector addressing. % Each pass in the loop v2(i) = v1(i) ^ 2 ; % calculates a new element % in the vector v2 end disp(v2) Name: Seat Number: __________ Common Functions sqrt(x) square root of x exp(x) = exponential function abs(x) absolute value of x log(x) natural log of x log10(x) log base 10 of x factorial(x) factorial function [ x! ], where x is a positive integer sin(x) / cos(x) / tan(x) trig functions with angle in radians sind(x) / cosd(x) / tand(x) trig functions with angle in degrees round(x) Round to the nearest integer fix(x) Round toward zero ceil(x) Round toward infinity floor(x) Round toward negative infinity rem(x,y) Equals the remainder of x divided by y if rem(x,y) == 0 Conditional test that is true when x is a multiple of y sign(x) Signum function – returns [1 if x>0], [‐1 if x<0], [0 if x=0] Name: Seat Number: __________ Practice Problems Problem 1: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of both the script file and the plot. Write a script file that plots the step‐input response of an RC circuit and an RLC circuit. Use a time interval 0
10 in increments of 0.01 seconds. The output “V” of each equation is in units of volts (V). Plot all three functions below for the time interval given. 5 1
⁄ 1 ∙ 2 is the natural frequency and τ is the time constant, 3 0.5 (0.5 cycles/sec) Start your script file with disp(‘Your Name, seat #’) Name: Seat Number: __________ Problem 2: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of both the script file and the plot. Write a script file that plots the three functions in the range 0 50 in increments of 1. Units are not necessary for labeling the plot. 100 50 25 3 400 59 229 Start your script file with disp(‘Your Name, seat #’) Name: Seat Number: __________ Problem 3: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of the script file, the plot and the command window output. Write a script file that plots the function given and calculates the area under the function for a range 0 in increments of 0.0001. sin Where N = 31,416 or the length of . Start your script file with disp(‘Your Name, seat #’) Name: Seat Number: __________ Problem 4: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of the script file, the plot and the command window output. Write a script file that plots the function given and calculates the number of elements in the ranges listed below. Use a range for the plot and values of the function of 0
20 seconds in increments of 0.001 s. Print the number of elements in each range with fprintf. ⁄5 2.3 sin 2 ∙ 2 0 1 1 2 2 3 3 4 Start your script file with disp(‘Your Name, seat #’) Name: Seat Number: __________ Problem 5: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of the script file only. Write a script file representing the code that the flow chart is outlining. The flow chart represents logic that will compute N! according to the equation ! 1 ∗ 2 ∗ 3 ∗ … ∗ . You do not have to run the script file with an input. Just print the script file as is. N_fact = 1 Start
clc
clear for i = 2:N Display YOUR student information. N_fact = N_fact*i i = i + 1 Ask user to assign input number to “N” Display N_fact End Name: Seat Number: __________ Problem 6: Show your work problem Use MATLAB to create a script file to accomplish the task described below. Save pdf files of the script file only. Write a script file representing the code that the flow chart is outlining. The flow chart represents logic that will determine MATLAB’s computational speed running a “while” loop for 10 seconds. You do not have to run the script file with an input. Just print the script file as is. Start while toc ≤ 10
clc
clear
cycles = cycles + 1
Display YOUR student information. speed = cycles/
toc
cycles = 0 Display computational speed to command window tic End Name: Seat Number: __________ 1) A plot is created by: 'plot(time,velocity,time,distance,time,acceleration)'. Write a single command to create a proper legend with labels DISTANCE, VELOCITY and ACCELERATION which corresponds to the generated plot. __________________________________________________________________________ 2) Write a single command to plot vector Distance as a function of vector Time. The plot produced should contain dashed red lines and no markers. __________________________________________________________________________ 3) Given that x=[1 2 3 4; 5 6 7 8; 9 10 11 12] has been assigned, what would be the result of y=x(2:3,[1 2 4])? __________________________________________________________________________ 4) Given a 10 by 3 matrix M, write a single command that extracts all members of the 3rd column of matrix M and assigns it to a vector called M_col_3 using the colon operator. __________________________________________________________________________ 5) The current flowing in the circuit is most nearly: a. 0.050 A b. 0.500 A c. 0.588 A d. None of the above. 5 V 10 Ω 40 Ω 40 Ω 10 Ω Name: Seat Number: __________ 6) Given that x = [3 6 9] has been executed in the command window, what is the command necessary 2 x to evaluate the expression x 2 x 13 ? (You must use only the necessary dot operators) ___________________________________________________________________
7) Given that x = [1:0.1:3] has been executed in the command window, what is the command necessary to evaluate the expression 2 cos
tan
/ ? (You must use only the necessary dot operators)
___________________________________________________________________
8) Given the function definition below, which variables are the input variables? function [z] = primenumber(x,y)
___________________________________________________________________
9) Given the function definition below, what should the function file name be? function [z] = primenumber(x,y)
___________________________________________________________________
10) Given the function definition below, can you use “x” as written within the main script file? function [z] = primenumber(x,y)
___________________________________________________________________ ...

View
Full Document

- Fall '14
- Wind turbine, PDF files, script file, seat number, do Command Group