You are on page 1of 2

Name (Last, First, MI) ID Number Math 323E

Montenegro,Kevin C. __________ PExer02

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

2. y = sin x2 y = sin(x.^2) y = 0.8415 1.0000 0.7781 0.0790 -0.7568

3. y = (sin x)2 y = sin(x).^2 y = 0.7081 0.9006 0.9950 0.9682 0.8268

4. y = sin 2x + x cos 4x y = sin(2.*x) + x.*cos(4.*x) y = 0.2557 0.9530 1.5814 0.9685 -1.0478

5. y = x/(x2 + 1) y = x./(x.*2 + 1) y = 0.3333 0.3571 0.3750 0.3889 0.4000

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

10. y = tan-1 (x) y = atan(x) y = 0.6421 0.3323 0.0709 -0.1811 -0.4577

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.

You might also like