REC04_Problems - 1 14:440:127 Introduction to Computers for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 14:440:127– Introduction to Computers for Engineers Recitation 04 Problems - Pertaining to LEC04 Notes Rutgers University, Spring 2011 Instructor - Brenda V. Cortez INSTRUCTIONS: You can create a separate M-file for each of the problems in your recitation problem sets, so that you can reference back to your answers later when you study. Save all your work to your MATLAB Files directory in the J: Drive. An alternative to separate M-Files, is to create a single M-file for all the problems, and use %% to create a cell for each problem. Refer to my Video Tutorial on the topic of cells found in Video Tutorials > LEC04 Video Tutorials in Sakai. For all problems, always think about what good variable names could be used, and even if the problem doesn’t explicitly specify variable names, get used to defining your own. Make sure you go through all the problems before the exam and ask any questions if you don’t understand why something works the way it does. PROBLEMS: 1. Create a variable, age , and store your age in it. Subtract one from the value of the variable. Add two to the value of the variable. If age has the value 18 , what is the value stored in age after executing the statements you just created? 2. Use MatLab to find the sum of 5, 2 squared, and 4. Assign this value to variable x . 3. Run the following two commands: 1) x = 56; 2) y = 87; Now, switch the values of x and y as was done in LEC04 Notes. 4. Write the code above in an M-file and save it as firstMLfile.m on your J: drive, in the MATLAB Files Directory. Make sure to add the J: drive to MatLab’s path. Edit the code above to display the values of x , y , before and after they are swapped. Then run your file by typing firstMLfile in the command window. 5. On a piece of paper, predict the outcome of the following MatLab calculations, and then test
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/30/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.

Page1 / 4

REC04_Problems - 1 14:440:127 Introduction to Computers for...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online