Create a single MATLAB script with each problem below as a separate section (hint: %%). 1. Create a new script 2. Create a comment section at the top with your name, date, HW#, class, etc. 3. The first script commands should erase all the workspace data, command window output, and close all figures. 4. Create separate sections (%% ) for each problem
Problem 1:
Use MATLAB to evaluate the following expressions
(a)
√
(b)
(c)
(d)
(e) (f)
(g)
(h)
(i)
(j) (k)
+
+
Find the sum of 5 and 3 divided by their product
Find the square of 2
/√
Find the cube root of the product of 2.3 and 4.5
−
+
+ −
( + . /) (. + . × −) × . × −
Problem 2:
Problem 3:
Create another section to do the following. Add a comment at the end of each line detailing what each line does. Make sure command outputs are not suppressed so outputs are published in your final document (as well as to the command window). a. Create the matrix
=
20 4 2 6 6 37 2 3 8 5 9 9
b. assign the first row of A to a vector called x1 c. assign the last 2 rows of A to an array called y d. assign the even-numbered columns of A to an array called B e. assign the transpose of A (i.e. turns it into a 4-by-3 array) to C f. compute the reciprocal of each element of A g. change the number in column 2, row 3 of A to 100.
Problem 4:
Problem 5:
Problem 6
a. Calculate the monthly payment (P) for a loan using the following formula:
where N is the number of years used to pay back the loan, r is the interest rate, and L is the loan amount. Set r to 15%, L to $50,000, and vary N from .5 to 20 years. If you enter your formula correctly P(20) = 658.39. Make sure to add comments explaining what the formula is doing. b. Plot the monthly payment vs. the number of years (make sure you have enough data
points to make a smooth curve).
c. Use the “text” command to print your name on the plot. Search MATLAB’s help
files for information if needed.
Turn in the following: 1. A Word (.doc, .docx) document created using the MATLAB publish feature to publish your script. 2. Your .m script file(s) (these are separate files from the document above). Make sure you use plenty of comments. Before submitting, rename all *.m files to have a .txt extension. For example, rename MyHW6.m to MyHW6.txt before submitting. Submit all files electronically on Blackboard. See syllabus for late assignment policy.
Late submissions will receive a 10% deduction! No submissions will be accepted after one day!



