QuestionQuestion

Problem 1 of 2: For the data set indicated below:
You are a chemical engineer, working with a process that requires delivery of several substances into a vat over the course of 30 minutes. Substance 1 is delivered at an increasing rate, TIME/30, and substance 2 is delivered at an increasing rate based on the intended size of the current batch of the final product, as input by the user, TIME* (batchSize + 5) / 200. The machinery takes instructions in the form of a .csv file. Write a program that asks a user for the intended batch size, then creates a .csv file to provide instructions to the machine.
1) Write a MATLAB script file (named D3_yourPID_Problem1_optionalDescript.m) that will:
a. The first line of your script file code should be a comment line with the standard header information. Include additional comments to describe the purpose of the code and the major sections
b. Clears the workspace and the command window.
c. Ask the user for the desired batch size, in kilograms.
d. Use the colon operator (:) to create a TIME vector with times between 1 and 30 minutes in one-minute increments.
e. Create a substance 1 rate vector using the TIME vector and the equation substance1Rate = TIME / 30.
f. Create a substance 2 rate vector using the TIME vector, the desired batch size, and the equation substance2Rate = TIME * (batchSize + 5) / 200.
g. Combine the vectors into a single three-column array, with TIME in the first column, substance1Rate in the second column, and substance2Rate in the third column.
h. Create a .csv file with the contents of your array, named D3_yourPID_SubstanceRates.csv. (e.g. if your PID is bdc0112, then your file name would be D3_bdc0112_SubstanceRates.csv).
i. Notify the user (through the command window) that a .csv file has been created, and indicate the file name.
2) Create a sample run using a desired batch size of 8 kg. Your screen capture should show the workspace and the command window for the sample run. Text within the screen capture must be legible.
Deliverables:
1) Problem 1 write up in PDF containing
a. Problem statement
b. Diagram – can put N/A in this section
c. Solution
i. The listing of the script file (copy and paste from MATLAB script editor; choose keep source formatting and reduce font size as needed).
ii. Screen capture of your sample run. Your screen capture should show the workspace and the command window for the sample run. Text within the screen capture must be legible.
2) Script file named D3_yourPID_Problem1_optionalDescript.m
3) .csv file with the contents of your array. This file should be named D3_yourPID_SubstanceRates.csv

Problem 2 of 2: You have been getting some bad grades recently, and are concerned. Your friend laughs and points out that you've been playing with your phone every day in class and during team meetings. You don't believe it's a problem, but your friend offers to keep track of how much time you spend on the phone instead of paying attention or participating. After a month, she gives you a file containing the data. You add the grades you received on daily assignments over that month to the file. Write a MATLAB program to import the files, then graph and analyze them. Answer some followup questions (given in the Deliverables section).
1) Write a MATLAB script file that:
a. Load the phoneTime.csv file. Note that the first column contains time spent on phone in class in minutes, and the second column contains grades for that day’s assignment or activity.
b. Use the plot command to create a scatter plot (on rectilinear graph paper) of your grades (Y) as a function of phone time (X), using ‘o’ to indicate each datapoint. Your plot should have axis labels that include quantity, symbol, and units; and your plot should have a meaningful title.
c. Use polyfit to find equations constants for the best-fit line.
d. Add a best-fit line describing the predicted relationship between grades and phone time in class to your plot, using the equation coefficients determined by polyfit.
e. Display the equation with units and descriptive variable names in the command window using fprintf. Numbers should be formatted so that there are no values after the decimal (notice the period in the following hint: %.0f )
2) Create a sample run showing output to the command window and the figure window. Your screen capture should show the workspace and the command window for the sample run. Text within the screen capture must be legible.
3) Answer the four follow up questions given in the Deliverables section.
Deliverables
1) Problem 2 write up in the same PDF as problem 1. Write up for this problem should contain:
a. Problem statement
b. Diagram – can put N/A in this section
c. Solution
i. The listing of the script file (copy and paste from MATLAB script editor; choose keep source formatting and reduce font size as needed).
ii. Screen capture of your sample run. Your screen capture should show the workspace and the command window for the sample run. Text within the screen capture must be legible.
iii. An image of the final plot (use Edit-‘Copy Figure’).
iv. Answers to the following questions
1. What do the results suggest about staring at your phone in class or team meetings?
2. What might explain the results?
3. What are two effects that a person staring at their phone during class or team meetings might have on the people around them?
4. Why might your classmates who are bothered by this behavior pretend that they are not bothered?
2) Script file named D3_yourPID_Problem2_optionalDescript.m

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

% D3 - MATLAB Challenge #3 - Problem 2
% this code is written to analyze the connection between time spend on
% phone in the class and the grades.

%% clear workspace and command window
clc;
clear all;

%% main code

data = csvread('phoneTime.csv'); %load data from 'phoneTime.csv' file.

X = data(:,1) % assign time spend on phone in the class (phonetime) to variable x
Y = data(:,2) % assign grades to variable y

P = polyfit(X,Y,1); % find coeficients of best fitting line

%% plotting results

figure (1)

scatter(X,Y,'o'); % create a scatter plot
hold on;
Y_line = X*P(1,1)+P(1,2);
plot(X,Y_line); % insert the best fitting line to the same graph

title 'variation of grades with phone time';
xlabel 'phone time / minutes';
ylabel 'grades...

By purchasing this solution you'll be able to access the following files:
Solution.zip, Solution.csv and Solution1.csv.

$75.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats