EXAM 1 – CS 151 FALL 2006 NAME

 MINISTERIO DE RELACIONES EXTERIORES COMERCIO INTERNACIONAL Y CULTO
        NUMÉRO
 ADDENDUM 1 OCTOBER 3 2021 ADDENDUM 1 TO

 ATTN USERS OF FREDDIE MAC SECURITIES DATA DATE
   SPERRFRIST 27 JANUAR 2020 19 UHR
 CEDAR DRIVE THRAPSTON NORTHAMPTONSHIRE NN14 4LZ TELEPHONE 01832

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

Exam 1 – CS 151, Fall 2006

Name: __________________________________


TA Name: _______________________________

I.Fill In (2 points each)

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


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


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


  1. The clear command performs what operation?



II.MATLAB Command Results (2 points each)

What value is produced when executing the following MATLAB equations:

  1. (4 + 8) / 2


  1. 4 + 8 / 2


  1. 2 * 3 ^ 2



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

  1. sqrt(x)


  1. rem(x,8)


  1. round(y)


  1. floor(y)


  1. asind( sind( z ) )



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

  1. max(E)


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


  1. sum( sum(E) )


  1. min( E );


  1. sort(E, ‘descend’)


  1. sortrows(E,3)


  1. size(E)


  1. length(E)


  1. E’



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

  1. F = complex(4, -2)


  1. real(F)


  1. conj(F)


  1. isreal(F)



III.MATLAB Commands (2 points each)

Give exact MATLAB commands for calculating or performing the following:

  1. 6 + 2

3 + 1


  1. ½ + ¾ _ 4 + 1

5 2


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


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


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


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


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


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


  1. 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:

  1. Assign the second column of H to x1.


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


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


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


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


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



IV.MATLAB Programs

  1. 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)


  1. 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)


  1. 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)



 CMPMSD NEW EMPLOYEEGUEST ORIENTATION FORM  REQUISITION NODATE
A COMMON ANNOTATION FRAMEWORK DAVID BARGERON ANOOP GUPTA AJ
CABINET 13TH MARCH 2012 MEETING COMMENCED 1000AM ADJOURNED


Tags: