# HW8 - Using the following information x 1 = 1 y 1 = 1 θ 1...

This preview shows page 1. Sign up to view the full content.

Homework #8: Functions Reading: 5.1, 5.2 Homework: This assignment will be done entirely in MATLAB. When asked for a “program” you should create an m-ﬁle (script) and any functions that are asked for. Be sure to turn-in the completed script and functions along with any runs you are asked for. In addition, you need a ﬂow diagram for each program. Turn problems in IN THE ORDER THEY ARE ASSIGNED. Each problem needs to be labeled so the TA can ﬁnd your work. Do the following exercises from your textbook 1. 5.18 2. 5.21 Most likely your code will have 8 inputs and 2 outputs although you can reduce the number if you like. φ 1 and φ 2 can only be between - 180 and 180 . Use the atan2() function to help with your calculations (see help atan2). Assume all angles are in degrees. Note that this problem requires you to do some geometry not explicitly shown in the book in order to calculate the needed values.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Using the following information x 1 = 1 y 1 = 1 θ 1 = 90 x 2 = 3 y 2 = 1 θ 2 = 90 r 1 = √ 2 φ 1 =-45 yields r 2 = √ 2 and φ 2 = 45. Test your code for x 1 = 0 . 5 y 1 =-1 θ 1 = 107 x 2 = 5 y 2 = 7 θ 2 = 270 r 1 = 3 φ 1 =-40 Write a MATLAB function that 3. Calculates the average and standard deviation of a data set, x . The average and standard deviation are given by average = μ = 1 N N X k =1 x k standard deviation = v u u t 1 N N X k =1 ( x k-μ ) 2 Your function should input the data set, x , and output both the average and standard deviation. Note that you are not allowed to use any built-in MATLAB functions to complete these calculations. Test your function for x = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online