Assignment title: Management


Q1. Create a function called A2_studentId_fun in a separate function m-file. Use your student ID in place of studentId in the function name. The function description is as follows: Input is x Outputs are y and z Function description (the relationship between input and the outputs) is z = x2 +1 and y = x2 - 1 if |x| < 2 z = 1/(x2 +1) and y = 1/(x2 – 1) if 2<|x| ≀4 z = sin(x) and y = cos(x) for all other values of x Write the commands to call the above function for input values of x = -0.8 x= 3.6 x= 5.4 in A2_studentId.m file. Q2. (From MATLAB for Engineers by H Moore, 3rd ed.) Create a vector x of values form 0 to 20  , with a spacing of /100. Define vectors y and z as 𝑦 = π‘₯sin(π‘₯) and 𝑧 = π‘₯cos(π‘₯) Using subplot command, on the same figure window: (a) Create an x-y plot of x and y. (b) Create a polar plot of x and y. (c) Create a three-dimensional line plot of x, y, and z. Add a title and labels. 3 Q3. (from MATLAB for Engineers by H Moore, 3rd Edition) Perhaps the most famous equation in physics is 𝐸 = π‘šπ‘2 which relates energy E to mass m. The speed of light in a vacuum, c, is the property that links the two together. The speed of light in a vacuum is 2.9979Γ—108 m/s. (a) Create a function called energy to find the energy corresponding to a given mass in kilograms. Your result will be in joules, since 1 kg m2 / s2 = 1 J. (b) Use your function to find the energy corresponding to masses from 1 kg to 106 kg. Use the logspace function (consult help logspace) to create an approximate mass vector. (c) Create a plot of your results. Try using different logarithmic plotting approaches (e.g. semilogy, semilogx, and loglog) to determine the best way to graph your results. Q4. For 5 ,4,3,2,1,0ο€½t evaluate the following: 72 ( ) ( ) k Y t k t k ο€½  οƒ₯ Display the final result (no intermediate values) on command window when the script file is executed. [Note: Final result should show the values of Y(0), Y(1), Y(2), Y(3), Y(4), Y(5)] Q5. Create a MATLAB structure called AustralianStates with the following fields: name population and land_area Then make that an array structure with 8 elements and populate the array structure with names of Australian states, population, and land area for each Australian state. Data for above can be found at http://en.wikipedia.org/wiki/States_and_territories_of_Australia (scroll down to see data). Use the values that you have stored in the MATLAB structure AustralianStates to find the total area and the population of Australia. Show your commands (to define, populate and evaluate the MATLAB structure) clearly on lab2_studentId.m file. When lab2_studentId.m is run, display the area and the population of Australia (no intermediate work to be displayed on the command window).