Exercise 1 Use one of Matlab/Octave/FreeMat (M/O/F, for short) to do the following exercises. Your report must document the steps or M/O/F command used to obtain the result. One way to do this is to cutand-paste from the command window. Try to also document your output in a sensible way. For example, if displaying the contents of some array or vector will take many lines, consider showing an abbreviated set of lines that will give adequate evidence that your solution is correct.
1.1. Create a vector named v of evenly spaced values from 0 to 20 (inclusive) in increments of 1.
1.2. Create a vector named angles of values from 0 to 2Ï€ radians in increments of Ï€/10. Note: M/O/F â€˜knowsâ€™ Ï€ natively, so you can form a value like 2Ï€ by typing: 2*pi Exercises 1.3 â€“ 1.4 below ask you to use array manipulation methods in M/O/F to accomplish the required task. This means for you to use the abilities that M/O/F has to operate on arrays to get your required results, rather than just retyping individual elements. For example, given the matrix A, where
1 2 3
ð´ð´ = 4 5 6
7 8 9
If you were asked to create a vector p consisting of the last row of A, instead of simply typing
ð‘ð‘ = [7 8 9]
you would do something like:
ð‘ð‘ = ð´ð´(3, : )
1.3. Use M/O/F array manipulation methods to build a two-column matrix where the first column consists of the values from Exercise 1.2, and the second column consists of the values from the first column converted into degrees. Do this using the vector v rather than having to re-type the values.
1.4. Use M/O/F array manipulation methods to add a third column to the matrix from Exercise 1.3, such that its elements number off the rows. In other words, 1 will be the top most element in the column, the next element down the column will be 2, and so forth down the column.
1.5. Use M/O/F array manipulation methods to modify the matrix from Exercise 1.4, so that the column you added in Exercise 1.4 becomes the first column instead of the third column.
Exercise 2 Use one of M/O/F to:
2.1. Enter and run the lines of code to the right. Include the code and the plot in your report
2.2. Take the code you entered, and paste it into an M-file, named exp_plot. Save it on the Desktop, and add the Desktop to the Matlab search path (File | Add path). Show your lab instructor your M-file will run when you type its name to the command prompt.
2.3. Modify the M-file code from 2.1 to annotate the plot with labels for the axes, a title for the plot, and a grid.
Exercise 3 Use one of M/O/F to solve the following problems:
3.1. The present value of an annuity (a yearly sum of money) may be computed from the formula:
P = (A/i) [(1 + i)n – 1]/(1 + i)n where A is the annuity (in $/year), i is the nominal yearly interest rate (in decimal form), n is the number of years over which the annuity is paid, and P is the present value in dollars. So, for example, if i = 0.15 (15%), A = $100/year and n = 10 years, then P = $501.88
Write a function in M/O/F that will compute and return the present value given the annuity, nominal yearly interest rate, and number of years as arguments (e.g., pv(A, i, n) ). Review the lecture notes or help files to see how to structure the lines of code using the M-file (or other) text editor to make them into a function.
3.2. If you won the $1,000,000 State Lottery and the Lottery offered you the choice of $500,000 today or $50,000/year for 20 years, which option would maximize the amount of money you receive? You can assume an inflation (interest) rate of 5%.
Exercise 4 Use M/O/F to:
Plot the function below as a mesh plot:
z = 3(1-x).^2.exp(-(x.^2) – (y+1).^2) – 10(x/5 – x.^3 – y.^5).exp(-x.^2-y.^2) … – 1/3*exp(-(x+1).^2 – y.^2)
Where both x and y are in the range of –3 â‰¤ x, y â‰¤ 3. (Note: the ellipsis, i.e., the three periods shown in the formula above, is a way in M/O/F to continue a long equation on multiple lines). Use enough points for x and y (like at least 30), so that you can see the contours of the function clearly. Annotate the axes, and include a title.
Be careful about simply copy-pasting the equation directly into M/O/F, because sometimes MS Word uses symbols that look like a mathematical operators, but that donâ€™t play well in programs like M/O/F, which deal with simple ASCII text characters.
Extra Credit: Create two sub-plots of the function above. One plot is the mesh plot, and the second is a contour plot. [Hint: search for help on subplot: help subplot ]. Put your code to do this in an M-file. Include the code and the plots in your report. What happens to the mesh plot when you increase (or decrease the number of points used for x and y?
 Problems 1.1 and 1.2 adapted from: Moore, H (2009) Matlab for Engineers, Prentice-Hall, NY
 Adapted from: Chapman, S. (2004) Matlab Programming for Engineers, Thomson, Canada
 Adapted from: http://www.facstaff.bucknell.edu/maneval/help211/p…
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more