This is not the document you are looking for? Use the search form below to find more!

Report

Document Description
File Details
• Added: March, 11th 2013
• File size: 112.77kb
• Pages: 2
• Tags: asdsm, asd, a, sdasd
• content preview
Submitter
• Name: dan
Embed Code:

#### Add New Comment

Content Preview
Purdue University Calumet
Engineering Department
ENGR 151
Software tools for engineers
LAB 7
Due date: Monday March 11, 2013
* Purpose: Review Lab.
* Step 1: Create a new script file LASTNAME LAB7a.m. Answer the following ques-
tions by writing in the script file
- Clear the screen and the variables.
- Display your name
- Display the text "Part 1"
- Generate 5000 random numbers from -2 to 5 and count up the number of elements
that are > 2 and < 3 and display the result using SPRINTF.
- Display the text "Part 2"
- Using what you have learned in the last several labs it is desired to first make a
plot of the following equation:
y = esin( (t-50))2
100
for t that goes from 0 to 100 by 0.5s.
Create a plot in a Figure 1 with time t as the variable on the x axis and the y
variable on the y axis. Add the title Y versus Time, the x axis label Time (sec)
and y axis label Y (meters) to the plot. Include a pause statement followed by a
line of code to close the figure.
* Step 2: Create a new script file LASTNAME LAB7b.m. Answer the following ques-
tions by writing in the script file
- Clear the screen and the variables.
- Display your name
- Display the text "Part 1"
- Using a FOR loop structure in the variable t with a time step size of 0.1 seconds,
find the first time t at which y passes through 1.5 meters.
- Display the text "Part 2"
- Using a FOR loop structure in t and again having a time step size of 0.1 seconds,
find the time t at which y is at a minimum.
1

Purdue University Calumet
Engineering Department
- Display the text "Part 3"
- Using a FOR loop structure in t with a time step size of 0.1 seconds, determine
the elapsed time required for y to go from 2.1 to 1.2 meters.
HINT: You may solve this problem using the following logic.
1) Add a variable etime and set it equal to zero before the FOR loop. 2) Inside
the FOR loop use an IF statement to determine if the value of y falls between
the values of 2.1 and 1.2 meters. If it does, add 0.1 seconds to the running total
for etime. 3) Use the SPRINTF and DISP commands to show the result of etime.
* Step 3: Upload the files LASTNAME LAB7a.m and LASTNAME LAB7b.m to
blackboard.
2

If it doesn't, click here to try again.

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/