Recitation 01 Problems

# Recitation 01 Problems - *Run the following three commands...

This preview shows page 1. Sign up to view the full content.

14:440:127 Introduction to Computers for Engineers, Fall 2009 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 School-of-Engineering 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, delete a single one of those variables using the clear command. *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 m-file and save it as firstrecitation.m on your J drive. Add the J drive to Matlab’s path and run your file by typing “firstrecitation” in the command window.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: *Run the following three commands: 1) x = 456; 2) y = 187; 3) z = 12; Now, switch the values so that x has y’s old value, y has z’s old value, and z has x’s old value. *Predict the outcome of the following Matlab calculations, and then test your predictions in Matlab: 5^2*3 5^(2*3) (1+3+5)/(5+3+1) *Use Matlab to calculate the square root of 2+3^4. Recall that a square root is a 1/2 power. *Create a variable r, set equal to 10. Calculate the area and circumference of a circle with radius r. There's a built-in variable "pi" that you might want to use. *For all of the following problems, set x = 15, y = 22, and z = 35. First, predict the results by hand. Then, test your predictions on Matlab: a) x>22 & y>22 b) x>22 | y>22 c) ~0 d) ~z e) x + y > 37 f) x + ( y > 37 ) g) x -y | 0 h) y>x & z>y & z>34 i) x>3 & x<5 j) 3<x<5 k) 14>=x l) 14<=x m) z-y-x>0...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online