程序代写代做代考 matlab Engineering 6 Spring 2016

Engineering 6 Spring 2016

Section A07 – Lab 2

Please read the following instructions carefully.

Create a new “m­file” or script using the “New Script” button on the upper left­hand corner of the

MATLAB window. Name this script lab2.m .

NOTE: do not change the location where the file will be saved MATLAB saves new scripts in a MATLAB

folder by default. Also, make sure that you have a “.m” at the end of the file name.

Part 1:

Plot the following functions on the same figure. In order to overlay the plots, use

Matlab’s hold command. Use linspace to create a vector, x , that ranges from

[− 7, 7] and includes 1000 points.

f (x) = xsin(10x)

g (x) = sin(10x)

Set the windows size for the plot by using the axis() function. The dimensions should be (-7, 7, -4, 4).

NOTE: Make sure to include axis labels, a title, and a legend. Lastly, each function should be plotted

using a different color.

Part 2:

Every quarter, UC Davis hosts a blood drive. The organizers of the drive are interested in learning

more about the donors. The following data was gathered.

Quarter and Year
(1) (2) (3)

Fall 15 Winter 16 Spring 16

Age Group Totals (17 – 30) 51 62 74

Age Group Totals (31+) 45 78 71

Gender Totals (Male) 29 89 52

Gender Totals (Female) 67 51 93

Use logical indexing to find the quarter(s) when the following conditions were true:

A. Male totals were larger than Female totals

B. 17-30 age group totals were larger than the 31+ age group totals

C. Female totals were larger than Male totals or the 31+ age group totals were larger than the

17-30 age group totals

Your final script should have the following structure:

% First Name:

% Last Name:

% Stu. ID:

%% Part 1

% Your code for Part 1 here…

%% Part 2

% Your code for Part 2 here…

To get credit for this lab, publish your lab2.m file and submit the published file, lab2.pdf, not the

m-file.

Instructions on how to submit:

● Step 1: Login to smartsite.ucdavis.edu, and go to the ENG6 SQ 2016 page.

● Step 2: Click on Assignments on the left panel.

● Step 3: Click on Lab 2.

● Step 4: Attach your lab2.pdf file.

● Step 5: Check the honor pledge (the square checkbox).

● Step 6: Click Submit.

● Step 7: Look for the confirmation message on the webpage for successful submission.

● Step 8: Check your e-mail box for the confirmation e-mail from SmartSite.

DO NOT DELETE THIS E-MAIL UNTIL YOU’VE RECEIVED A GRADE FOR THE

ASSIGNMENT

● Step 9: Check Smartsite->Assignment->Lab 2 to see if attachment was uploaded correctly. If

not, submit again.