{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EngE_1104_Spring_2007_Lab_6_Students_Copy_V1B_1

# EngE_1104_Spring_2007_Lab_6_Students_Copy_V1B_1 -...

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

Explorations Of Our Digital Future Spring 2007 Lab 6 – Loops in Raptor and MatLab Version 1B, Copyright by: Jeremy Garrett and Tom Walker, July 2006 – Jan. 2007 Preparation: No special preparations required. No lab warm-up required for this particular lab. Lab Objective: To use and explore “for” loops and “while” loops in Raptor. To use and explore “for” loops and “while” loops in MatLab. To use and explore nested loops in both Raptor and MatLab. Lab Overview: In this lab/activity, we will use Raptor to design and create (and then test) an algorithm, that creates multiplications tables. Then when we have it working we will duplicate that program in MatLab (as with did in Lab 2). In Part 1, we will create a small script in Raptor that will allow us to practice creating and using loops inside flow charts. In Part 2, (and only in Part 2) you may work with a partner in order to use Raptor to design, build, and test the script described above. In Part 3, you will need to resume working on your own (again, partners are only allowed in Part 2), and then copy your flowchart script, from Raptor, into the MatLab script editor (making syntax changes as needed). Part 1 – Exploring Flowchart Loops in Raptor: Part 1 – Background: As described in the Overview, this part of the lab will provide us with a chance to practice creating and using loops in Raptor. The script/program that we will create and practice on will read in two numbers, print a list of numbers that starts at the first one and stops at the second one, and then prints out the sum of those numbers. Part 1 – Procedure: Open Raptor, and then immediately save the (currently empty) file to a folder of your choice, using a file name that includes your name and a meaningful description. Right-click on the “Start” oval, and add a comment that contains your name, the date, and the title of this lab/activity.

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

View Full Document
Add an input parallelogram that asks the user for the number that they would like to start the listing and summation at. Be sure to create a “prompt” (message given to the user) that explains what they are being asked to provide. Add a second input that asks the user for the second number (which will act as end of the list). At this point, your script should look like the example shown to the right. Now insert an assignment rectangle, just above the End command, that creates the variable “Sum” and set it equal to zero. Insert a second assignment rectangle, but this time define the variable X, and set it equal to the first variable that the user gave as input. Now insert a Loop. Then double-click on that diamond symbol that appears, and enter: X > Var2 where Var2 is replaced with the name of the second variable that was input by the user.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}