首页 >
> 详细

ENGR 131: Elementary Computer Programming

ENGR 131 20F-IN-030-05 (Lab 5 Instructions) 9/24/2020 Page 1 of 3

Lab Exercise #5

INSTRUCTIONS

Complete the exercises below and upload them to Canvas as a single MATLAB script file using the naming

convention “ENGR131_20S_Lab##_abc123.m”, replacing abc123 with your Case ID, and ## with the two-digit

lab number.

For example, if Dr. Williams were submitting Lab 5 it would be ENGR131_20F_Lab05_mrw8.m

For your script, please perform the following:

1. Separate each question into separate, runnable sections using the “%%” comment notation.

2. You may use the code and notes from class, the textbook, MATLAB’s documentation, and anything you

find using Google to solve these problems.

3. Use comments as appropriate to indicate your thoughts and how your code works (or is supposed to work).

This is 5 points (10%) of your grade.

QUESTIONS

There are 2 questions for this lab.

1. SOLVING SYSTEMS OF EQUATIONS (5 PTS)

Given the system of equations below, solve for the value of each letter using the numeric technique (not symbolic).

A + A + B + B = 63

A + B + C + D = 40

A + E + E + B = 15

A + C + C + D = 26

E + B + C + D = 33

2. COMPUTING VOLUMES (40 PTS)

A particular conical red cup is often found at many social gatherings in college. The dimensions of this cup can

be found in Fig. 1. Based on these dimensions, use Matlab to determine the locations at which you would place

markings for 2.75, 6, and 16 oz. of fluid. Also compute the error in your computed volume from these three target

volumes.

ENGR 131 20F-IN-030-05 (Lab 5 Instructions) 9/24/2020 Page 2 of 3

To recreate something similar to Fig. 1b and c, perform the following:

a. Create a function to compute the radius of the cross section of the cup for an input x vector. Keep in mind

that Fig 1a lists diameters and you want radii (3 pts)

b. Create a function that will plot your results based on input arguments of your step size (outer) loop and

your computed heights.

a. This function should plot

i. the overall profile of the cup (2 pts)

ii. The marking locations based on step size = 0.01 in with closed marker faces (3 pts)

iii. The marking locations based on step size = 0.2 in with open marker faces (3 pts)

b. It should include appropriate labels and titles (3 pts)

c. Adjust the axis limits so they’re even and the cup profile looks right (1 pts).

d. Hint: You’ll need both the x and y values for the markers. Once you record your computed target

height (Part d below) you can always call the function you created in Part a to get the y for plotting.

Fig. 1. Dimensions of popular party cup (a), profile of cup

with indications of volume measurements for 2.75,64, and

16 oz (b). Closed markers indicate step size of 0.01 in, open

are for step size = 0.2 in. Volume errors of computed

marking locations relative to target volumes by step size (c).

Cup Profile With Markings for 2.75, 6, and 16 oz

2.75 6 16 2.75 6 16

Volume (oz) by step size (0.01 & 0.2 in)

Error as a function of step size and target volume

ENGR 131 20F-IN-030-05 (Lab 5 Instructions) 9/24/2020 Page 3 of 3

c. Create a matrix of target volumes. Remember to convert the units given into in3 (1 pts)

d. Since you’re iterating over 2 step sizes, and determining three currently unknown values, create a nested

loop structure using the following loops:

a. An outer for loop that determines step size (0.01 or 0.2) (4 pts)

b. An inner for loop that determines the target volume to test (4 pts)

c. An inner inner while loop that computes the volume of the cup by integrating the volume of the

revolved solid for an incrementally increasing height. You are welcome to use either the Riemann

or trapz method of integration. This loop should exit once the height that produces the target

volume is determined (10 pts).

i. Hints:

• Use a counter in the while loop that increases by 1 every time through the loop

• x = [0:dx:counter*dx]

• Store your final computed target heights OUTSIDE of the while loop, but inside the inner

for loop in a 2x3 matrix where the row is for each step size and the columns are for each

the target volume

• Record the error (Computed volume / target volume) similarly

e. Plot the errors in volume as a bar plot with appropriate title and labels (6 pts)

a. Hint: use set(gca,’XtickLabel’,{ {'','2.75','6','16','','','2.75','6','16'}) to get the x labels correct

Revision Description Date

A Original Document 9/24/2020

联系我们

- QQ：99515681
- 邮箱：99515681@qq.com
- 工作时间：8:00-23:00
- 微信：codinghelp

- Cpslp程序语言代写、代做python编程设计、Program程序实验代写 2020-11-25
- Csci 1110作业代做、Data留学生编程代写、Java程序语言调试代做 2020-11-25
- 代写program程序、代做r课程编程、R程序实验代做代做留学生prolog 2020-11-25
- Be491留学生编程代做、代写java，Python/C++程序设计调试ma 2020-11-25
- 代写cmpt 214编程、代做programming语言、代写c/C++程序 2020-11-08
- 代写csci 2122课程、代做program编程实验、C++程序语言代写代 2020-11-08
- Fit5032语言编程代做、代写web程序实验、Web、Html程序语言代做 2020-11-08
- Com3503程序编程代做、Java，C++，Python留学生编程代写代写 2020-11-08
- 代写program程序课程、代写c++编程实验、C/C++编程语言代做 代做 2020-11-08
- Data留学生编程代做、代写python程序、Java，C++程序语言代写 2020-11-08
- 代写secj 1023实验编程、Programming程序代做、代写c++语 2020-11-08
- 代写cmpsc 465编程、代做java程序语言、Python，C++编程设 2020-11-07
- 代做mf 703语言编程、代写programming程序、Sql编程语言调试 2020-11-07
- 954246编程设计调试、代做programming程序、C++编程语言代写 2020-11-07
- Pstat 115程序实验代写、R编程语言调试、Data留学生程序代做 代写 2020-11-07
- Com1005课程编程代做、代写python程序、Java，C++程序语言调 2020-11-07
- Tcp留学生程序代写、Java程序设计调试、Java编程语言代写 帮做r语言 2020-11-07
- 代写program语言编程、代做data留学生程序、Python，Java编 2020-11-07
- 代做cosc2666编程、代写programming程序、C/C++程序语言 2020-11-07
- Digital编程设计代写、代做r程序实验、代写r留学生程序 调试matla 2020-11-07