REC04_Problems

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

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

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.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern