CS101

Lab activity #1 Answer Sheet


Name: ________________________________________

Section: ______

 

Getting Started

Your first task is to log-in to a computer. Type your NetID in the box marked 'Login:'

Type your Active Directory (AD) password in the box marked 'Password:'. Your AD password is the one used for Netfiles and to log into many machines on campus. Note: This password isn't necessarily the same as your Cites E-mail password or your bluestem (NetID) password.
If you do not have an AD password, you may reset it at the following link: http://accounts.ad.uiuc.edu

Your next task is to load the Lab 1 instructions. The instructions are on the CS 101 website. To find them, follow these steps:

Part 1 Questionnaire

This information will be used by your TA to set up your Lab groups and Lab activities.

What do you hope to learn in CS101?

__________________________________________________________________

What is your major? _____________________________________
Have you programmed before, if so for how long, with what language(s)?

_______________________________________________

Have you used UNIX/LINUX before(yes/no)? _______________



Return to the instructions on the web.

Part 2 Matlab constants

Fill in the following blanks with the correct answers. If the answer gives a Matlab error message, don't write down the entire message, just fill in the blanks with the word ERROR.
Before you type the following make sure to first type

>> format short e

at the Matlab prompt.

1.  _______________________  ( think 1 over 3)


2. _______________________ (think 1 under 3)


3._______________________ (exponentiation 2 raised to the fifth power)


4. _______________________ (operator precedence)


5._______________________ (parenthesis can change operator precedence)


6.______________________ (check your Calculus book on the following)


7.______________________


8.______________________


9.______________________


10.______________________


11.______________________


12.______________________


13.______________________


14.______________________


15.______________________  (Check your high school algebra book on the imaginary number i .)


16.______________________ (The general form of a complex number is "a+bi" where a and b are real numbers.)


17.______________________ (no * is needed with the imaginary part)


18._______________________ (addition of complex numbers)


19._______________________ (multiplication of complex numbers)


20._______________________ (division of complex numbers)

Return to the instructions on the web.

Part 3 Matlab lists (row vectors and column vectors)

(Note: In the following, [1   2   3] is not the same as [123])

21.______________________


22. _______________________


23._______________________  (the two vectors are of the same length but not the same size)


24.______________________


25._______________________


26._______________________

Return to the instructions on the web.

Part 4 Matlab variables

27.______________________


28._____________________  (didn't we assign [1 1 1] to x???)


29._____________________


Return to the instructions on the web.

Part 5 Matlab functions

30._____________________ ( equally spaced vector starting at -1 ending at 1 with 4 values)

31.______________________ (of course!)


32.______________________


33.____________________


34.____________________


35.____________________ (sums values in columns for a table; nearly all Matlab functions work this way on tables)

 
36. _____________________ (diff(x) consecutive differences of values in x)


37._____________________(arithmetic average = (1+2+3)/3)


38.______________________( median(x) = as many values above as are below)


39._____________________


40._____________________ (cumulative sum)


41.______________________


42.______________________  ( abs( a+bi) = sqrt(a*a + b*b) )


Return to the instructions on the web.

Part 6 Matlab Editor

You should read the instructions for Part 6 and create a Matlab script file before you attempt the following:

43. Before we run the script file, in the Matlab environment, enter the who command, which lists all your variables:

>> who

List the variables: (Write "Nothing" if no variables appear)

_______________________________________________________________________


44. Now type the following,

>> clear
>> who

List the variables:

_______________________________________________________________________

45. Next type,

>> r = 1;
>> who

List the variables:

_______________________________________________________________________

>> r

46.
What is the value of r? _________

Use the "what" system command to make sure that you have correctly saved your lastname.m file.

>> what (this lists the .m and .mat files in your directory)

If you don't see the "lastname" file ask your TA for help before you proceed.


47. Run the script by typing your last name at the prompt.

Write what is displayed on your screen:

________________________________________________________________

48. Type

>>r

What is the value of r? _________


49.  So, can running a script alter the value of a workspace variable?  Y / N


50. Again, type

>> who

List the variables in your workspace:

_____________________________________________________

Return to the instructions on the web.

Part 7 Symbolics in Matlab

51. Compute the derivative of t3 with respect to t,

>> syms t

Note: When you execute the syms command, you may see a page of red text. If you do, please restart Matlab.

Fill in the blank with Matlab code to call the diff function to compute the second derivative of  t3. You must use the diff function.

>> solution = _______________________________ 
(The solution should be 6t, but you should write the command used to find the solution.)

52. Write the result of executing the following code,
>>  syms y
>> limit(sin(y) / y, y, 0)


___________________________

53. Write the result of executing the following code,
>> syms z
>> diff(sin(z), z, 4)
(this is called the fourth derivative of sin(z) with respect to z)


____________________________

Return to the instructions on the web.

Part 8 Course website

54. Find in the course syllabus: Find the grade range(in points) for an A- grade for CS101:

____________________________________

55. Click the "Staff " hyper-link: What is the email address of your lab TA?

____________________________________


Return to the instructions on the web.

Part 9 Security

56. Follow the instructions in Part 9.
Then, obtain the signature of your TA and submit this answer sheet to your lab TA.
 


_______________________________________________