{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CE8_lab2

# CE8_lab2 - CE-8 Lab 2 Basic MATLAB Use Part 2 Lab...

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

CE-8 Lab 2: Basic MATLAB Use - Part 2 Lab Objectives (PLEASE BRING YOUR ROBOT AUTOMATIION BOOK TO LABS.) By the end of this lab you should be able to: 1. Identify what a variable is and how one is used in a program. 2. Create a program that properly uses IF, ELSE commands. 3. Use IF ELSE and FOR to give any condition and repetition to calculate multiple problems all at the same time. Variables You can use variables in expressions to set their values. Its important to remember when working with expressions that the right hand side of the expression is evaluated first. For example, if want our variable 'xyz' to be equal to 5 plus 3 we would simply write. xyz = 5+3 This statement first computes 5 plus 3 and then sets the variable 'xyz' to that value. We can also use variables in the right hand side equation, even if its the same variable as the one on the left hand side. For example: xyz = 5+3 xyz = xyz*2 What do you suppose the value of 'xyz' is? Lets look at these two commands in the way our robot will look at them. The first thing it does will add 5 and 3, it will then set 'xyz' to be equal to this value which is 8. It will then

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