What size of a matrix is created when the MATLAB command …



Fill In (2 points each)

1. What size of a matrix is created when the MATLAB command A = 5 is executed?

2. What type of data is stored when the MATLAB command B = [ 2 4 5 ] is executed?

3. The command isvarname prog-1 will return what value?

4. The clear command performs what operation?

MATLAB Command Results (2 points each)

What value is produced when executing the following MATLAB equations:

5. (4 + 8) / 2

6. 4 + 8 / 2

7. 2 * 3 ^ 2

Given the vectors: x = [4 25 81], y = [3.5 -2.5 9.8 -8 0] and z = [30 45], find:

8. sqrt(x)

9. rem(x,8)

10. round(y)

11. floor(y)

12. asind( sind( z ) )

Given the matrix: E = [2 5 8;-2 10 14;-8 4 7;12 9 -1], find:

13. max(E)

14. [a,b] = min(E)

15. sum( sum(E) )

16. min( E );

17. sort(E, ‘descend’)

18. sortrows(E,3)

19. size(E)

20. length(E)

21. E’

What will show in the command window after entering the following MATLAB commands:

22. F = complex(4, -2)

23. real(F)

24. conj(F)

25. isreal(F)

MATLAB Commands (2 points each)

Give exact MATLAB commands for calculating or performing the following:

26. 6 + 2

3 + 1

27. ½ + ¾ _ 4 + 1

5 2

28. Create a matrix C of evenly spaced values from 2 to 16, with an increment of 2.

29. Create a matrix D of values (incremented by 1) from -20 to -10.

30. Use the linspace() function to create a matrix of 8 evenly spaced values from 10 through 20.5.

31. What MATLAB command allows you to view 14 decimal digits of a variable value?

32. What MATLAB command allows you to view only 2 (rounded) decimal digits of a variable value?

33. Create a 20 by 35 matrix of normally distributed random values.

34. What MATLAB command clears the workspace of variables and their respective values?

Given the matrices: G = [3 2 0 -4], H = [5 1 3 2; 6 2 -1 4; 8 10 7 11; -1 15 -5 8], I = [2; -3; 4; -5], write MATLAB commands for the problems 35-39 and show the result that would be printed:

35. Assign the second column of H to x1.

36. Assign the diagonal (offset by 0) of H to x2.

37. Convert H to a column vector and assign it to x3.

38. Insert the value of 7 to the sixth position in vector G and print out the value of G.

39. Find the value H( I(3) ).

40. Create two two-dimensional matrices using the two input vectors, G and I, using the meshgrid() function.

MATLAB Programs

41. You have a box with a length of 4 feet, width of 1.5 feet and height of 2.5 feet. Write a MATLAB program that finds the area of the bottom of the box, the surface area of the box (area of all sides of the box) and the volume of the box. (8 points)

42. The displacement of an oscillating spring can be described by the equation, x = Acos(wt), where x is the displacement at time t, A is the maximum displacement, w is the angular frequency and t is the time. Write a MATLAB program to find the displacement at time t for times between 0 and 10 seconds (2 second increments), maximum displacement of 4 cm and angular frequency of 0.6 radians per second. Create a table (2 columns) of displacement and time values. (8 points)

43. The area of a triangle is area = ½ base times height. Write a MATLAB program to find the area of a group of triangles whose base varies from 1 to 5 meters (1 meter increments) and whose height varies from 2 to 6 meters (2 meter increments). Your answer should be a two-dimensional matrix. (8 points)

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download