This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CE8 Lab 2: Basic MATLAB Use  Part 2Lab 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 What do you suppose the value of 'xyz' is?...
View
Full
Document
This document was uploaded on 08/23/2010.
 Fall '09

Click to edit the document details