engineering homework

profilehaauxo6
112hw7a.docx

ENGR 112 HOMEWORK ASSIGNMENT #7

Problem #1. (10 points) Write a user-defined SCILAB function for the following function:

r = -1 + sin(Θ)

The input to the function is Θ (in radians) and the output is r. Write the function such that Θ can be a vector.

Use the function to calculate r(π/3), and r(3π/2).

Use the function to plot (polarplot) r(Θ) for 0≤Θ≤2π.

Problem #2. (2 points) Create a row vector a1 consisting of the numbers in the ordered set (1, 5, 7, 22, 12) using the square bracket operator.

Problem #3. (2 points) Create a row vector a2 consisting of the numbers in the ordered set (1, 4, 7, 10) using the colon operator.

Problem #4. (2 points) Create a row vector a3 starting with the element 1, ending with the element 10, with five equally spaced points in the vector. Use linspace.

Problem #5. (4 points) Define the variable x as follows:

x = [3, 9, 4, 99, 21]

Change x into a column vector.

Create a vector y whose elements are the sin of x.

Create a variable myMax, which if the maximum of all elements in x.

Create a variable mySort, which contains all values in x in increasing order.