Professional Documents
Culture Documents
Task I. For row vector x with values from 1 to 2 in steps of 0.25, evaluate the following mathematical expressions and supply the correct MatLab command and its result.
Mathematical
Matlab Command Result
Expression
x = 1:.25:2
1. y = x3 + 3x2 + 1 y = 5.0000 7.6406 11.1250 15.5469 21.0000
y = x.^3 + 3*x.^2 +1
cos x
6. y= y = cos(x)./(1+sin(x)) y = 0.2934 0.1618 0.0354 -0.0898 -0.2180
1 sin x
1 x3
7. y= 4 y = (1./x) + (x.^3)./x.^4+5.*x.*sin(x) y = 1.1920 1.0333 0.9357 0.8694 0.8188
x x 5 x sin x
x
8. y= y = x./(x+(1./(x.^2))) y = 0.5000 0.6614 0.7714 0.8428 0.8889
x x12
1 1 3
9. y= 3
2 y = (1./(x.^3))+(1./(x.^2))+(3./(x)) y = 5.0000 3.5520 2.7407 2.2274 1.8750
x x x
Task II. Explore the use of functions round, ceil, floor and fix for each value of x. Write down the result of each function in its specified column.
x round( ) ceil( ) floor( ) fix( )
11. 0.3 0 1 0 0
Name (Last, First, MI) ID Number Math 323E
Montenegro,Kevin C. __________ PExer02
12. 1/3 0 1 0 0
13. 0.5 1 1 0 0
14. 2/7 0 1 0 0
15. 1.65 2 2 1 1
16. 1/2 1 1 0 0
17. -1.34 -1 -1 -2 -1
18. 5/9 1 1 0 0
19. 4.95 5 5 4 4
20. 2.85 3 3 2 2
Task III. Create a Matlab function named xrcff( ) that would do the following:
a) Assign the values of x as indicated in Task II
b) Perform the functions round, ceil, floor, and fix for each value of x
c) Display the table of values with the following data: x, round(x), ceil(x), floor(x), and fix(x) formatted into two decimal digits. Make sure to include appropriate
heading on your table.