14:440:127
Introduction to Computers for Engineers
Recitation 1

Problems for students to attempt
*Use Matlab to find the sum of 5, 2 squared, and 4.
*Set the variable
matlabvariable
to equal the difference of 453 and (4 to the third power).
Then,
on the next line, increase
matlabvariable
by 15.
*Which of the following variable names are permitted?
7up
SchoolofEngineering
Rutgers
for
Rutgers_University
sin
*Create a bunch of variables (some with decimals, some with character arrays i.e. x = ‘hello’ )….
and then use the
whos
command to verify what variables have been defined.
Then, use the delete
command to clear any one
of the variables.
*Run the following two commands:
1)
x = 56;
2)
y = 87;
Now, switch the values of x and y.
*Answer the problem above in an mfile and save it as firstrecitation.m on the Desktop.
Add the
desktop to Matlab’s path and run your file by typing “firstrecitation” in the command window.
*Let ranking = 1.
Write an
if statement
that displays ‘New Jersey Devils’ if ranking equals 1.
*What would be wrong in the previous problem if the statement were ‘It’s Tiger Woods’?
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '09
 blase
 Equals sign, old value, Jersey Devils, ‘Not Michael Jordan, ‘New Jersey Devils

Click to edit the document details