Name: _____________________________________     Section # _____________
 

Due Date: During Lab period 

Lab Activity #2 Answer Sheet

Part 1 Matlab constants

1.
>>  string = [ 'test' ,    _________________________________________________  ];


 number           __________________________________________________
 

string               __________________________________________________

Return to lab instructions on the web.

Part 2  Matlab operators


2.             ___________________________________________


3.             __________________________________________


4.            ___________________________________________

   

              ____________________________________________


5.          _____________________________________________


6.          _____________________________________________


7.         _____________________________________________


8.        ______________________________________________


9.        ______________________________________________


10.       ______________________________________________


11.       ______________________________________________


12.       ______________________________________________


13.      ______________________________________________


Return to lab instructions.

Part 3. Vector carving (subscripting)

14.   ______________________________________________  


15.   _____________________________________________


16.   _____________________________________________


17.  _____________________________________________(approx.)


18.  ______________________________________________(approx.)


19. >> z =     [ 0  , ___________________________________ ]
   (The correct answer must use the variable y and subscripting on y)


20.  >> flipy = y(  end : _____________  : _______________ )
 

Return to the lab instructions.

Part 4 Matlab functions

21. >>floor( ___________________ * _____________________ ) + 1



22. random =  __________________________________________________________

Return to the lab instructions.

Part 6  Symbolics in Matlab

23.  __________________________________________________________


24. (Just write the answer, don't write the intermediate results)     ans = ________________________________________   (Euler's formula)


25. Fill in the blank below to simplify the  mathematical function cos(2x) / (cos2(x)-sin2(x)).
   
     >> simple(________________________________________________________________)

Part 7  Discretization in Matlab

26.   ________________________________________________________________________
    

27.   >> x2 = ________________________________________________________________

       
        >> y2 = ________________________________________________________________

Part 8   Plotting

28.
>> x = ____________________________

>> y = ____________________________

>> plot( _______________________ , ____________________________, ___________________________)


29. Does plot(x2,y2) give the same results as plot(y2,x2) ________________________(YES/NO)?

Part 9  Differentiation


30. Which value of h gives us the best approximation to the derivative, that is, which value of h gives us the smallest error?

h = ________________________________________________________________



31.

>> midpoints =  _________________________________________________________ ;


32.
>> yprimes = ________________________________________________________ ;




Part 10  Logical values and operators

33.  >> w =  v ( _____________________________________________________)


34. >> w =  v ( _____________________________________________________)


35.    r =  _________________________________________________ ;



36. result = ______________________________________________ ;



Congratulations, you are done!