Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab ENCMP 100-Computer Programming for Engineers Page 1 of 6 ENCMP 100 - Computer Programming for Engineers Assignment #4 Rev 2 Due: Friday, March. 19

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedMatlab

ENCMP 100-Computer Programming for Engineers Page 1 of 6 ENCMP 100 - Computer Programming for Engineers Assignment #4 Rev 2 Due: Friday, March. 19 2021 at 6:00pm MST Objective This assignment is designed to provide you with practice using functions to preform computations, and structure arrays to create and save data. You will develop a MATLAB program that utilizes functions to summarize a user's fitbit data. Marking Scheme You will get a total of 100 points for completing the following: POINTS 0 25 TASK Rev. 0 Fully functional program you are to produce Rev. 1 Get and display first 31 row of data working correctly using functions and structures Rev. 2 Get and display entire dataset using functions and structures Quality of code: 25 points per submission TOTAL 25 50 100 Points for Quality of Code Complete file header Design (appropriate use and naming of variables) Comments in the code Layout (indentation/spacing) Did you follow filename naming convention . C Submission Filename naming convention Assign4R1_.m Ex. CCID or email : jmac filename for assignment #4Revl is Assign4R1_jmac.m Submit only your .m file under Labs, Assignment 4Revl submission in your eClass Assignment Due on Friday March 19 2021 at 6:00pm MST Please thoroughly test your code to ensure functionality, and compare results to the included Rev 0 program. . ENCMP 100-Computer Programming for Engineers Page 2 of 6 Problem and Program Details: Rev 0 Getting Started You are tasked with providing a reader-friendly summary of a client's fitbit data. This will be an integral part of a report of the client's health and activity. Posted on eClass, under Lab 4 Information is a zip file containing four files: Data_Year.mat -> this is your data file which contains fitbit data for a year Assign4_ccid.m -> a template to work from Rev1.p -> Program outputs for Rev 1 of your code Rev2.p -> Program outputs for Rev 2 of your code Unzip the contents in to a directory or folder and work from that directory or folder. The data file and *.m file must be in the same directory or folder. Remember to rename the skeleton code filename with your CCID. To run the included Revl.p or Rev2.p, in Matlab, goto your current folder window where you have unzipped your files, right click on *p and select run. Review the outputs on the command window, and the files that are created after the program runs. Rev 1 Your objective is to create, and save a new structure array that contains the following items: Month - can be copied from the Data_Year.mat structure array Day- can be copied from the Data_Year.mat structure array Year - can be copied from the Data_ Year.mat structure array Steps - can be copied from the Data_Year.mat structure array Distance - to calculate this take the number of steps multiplied by 0.0006 to convert steps to kilometers Floors -- can be copied from the Data_ Year.mat structure array Sleep - you will need to add the Sleep and Nap values together to get the total hours slept. Please note the minutes field needs to be converted in to hours. Resting Heart Rate - can be copied from the Data_ Year.mat structure array When you save your structure array, use the save command and use your name as the filename with the extension *.mat Then display a graph of the following graphs from the data contained in the new structure array: Total sleep vs days Steps vs days Floors climbed vs days Resting HR (Heart Rate) vs days You should use the subplot function, along with the plot function Your chart should look similar to this: ENCMP 100-Computer Programming for Engineers Page 3 of 6 Sleep 104 Steps Floors Climbed 10 55 70 Resting HR 9 50 1.6 58 1.4 67 12 65 30 25 63 0.B 20 0.6 15 61 10 0.4 O 60 10 30 10 30 10 30 10 30 20 Days 20 Days 20 Days 20 Days Then display the contents of the new structure array to the command window with a title and your name with your CCID. Along with the totals for the month of sleep, steps, distance, and floors climbed. Other stats that may be useful to the client are minimum, mean (or average) and maximum values of sleep, steps, and floors climbed. Your output should look similar to this, when being marked, we are concerned with the data not formatting: ENCMP 100-Computer Programming for Engineers Page 4 of 6 2018 Resting HR 68 67 66 69 67 68 67 Jan. 68 69 69 70 68 >> Revl ENCMP100 Assignment #4A Fitness Data Display Anaylsed by Joe MacDonald (jmac) Month Day Year Steps Distance Floors Sleep Jan. 1 2018 5648 3.389 20 7.4667 Jan. 2 11260 6.756 29 4.9833 Jan. 3 2018 11224 6.734 34 1.2000 Jan. 2018 14851 8.911 32 8.1167 Jan. 5 2018 10502 6.301 17 8.9667 Jan. 6 2018 5033 3.020 17 7.0667 Jan. 7 2018 8908 5.345 20 4.7833 8 2018 11718 7.031 35 6.7500 Jan. 2018 14562 8.737 38 4.4833 Jan. 10 2018 10920 6.552 26 5.5667 Jan. 11 2018 10828 6.497 33 5.2833 Jan. 12 2018 14295 8.577 25 7.5333 Jan. 13 2018 5599 3.359 17 8.9000 Jan. 14 2018 5758 3.455 15 6.7500 Jan. 15 11650 6.990 42 4.6667 Jan. 16 2018 12428 7.457 28 6.7500 Jan. 17 2018 15732 9.439 36 6.0000 Jan. 18 2018 15304 9.182 27 6.4833 Jan. 19 2018 5975 3.585 14 8.9667 Jan. 20 2018 6410 3.846 13 8.5500 Jan. 21 2018 6701 4.021 28 5.0333 Jan. 22 2018 13384 8.030 50 3.1833 Jan. 23 2018 10680 6.408 43 4.9500 24 2018 11283 6.770 45 8.0833 Jan. 25 2018 17194 10.316 22 5.1000 Jan. 26 2018 6445 3.867 21 9.4333 Jan. 27 2018 6132 3.679 20 8.2167 Jan. 28 2018 6315 3.789 22 6.4833 Jan. 29 2018 11538 6.923 34 5.3667 Jan. 30 2018 13183 7.910 51 4.3667 Jan. 31 2018 11820 7.092 32 6.2833 67 67 2018 68 68 67 68 65 65 64 63 64 Jan. 64 67 65 62 60 60 62 Totals Steps 323280 Distance 193.968 Floors 886 Sleep (hours) 195.7667 Min values: Sleep (hours): 1.20 Steps: 5033.00 Floors climbed: 13.00 323280 193.968 886 195.7667 Min values: Sleep (hours): 1.20 Steps: 5033.00 Floors climbed: 13.00 Mean/Average values: Sleep (hours) : 6.32 Steps: 10428.39 Floors climbed: 28.58 Max values: Sleep (hours): 9.43 Steps: 17194.00 Floors climbed: 51.00 fx >> | ENCMP 100-Computer Programming for Engineers Page 5 of 6 Code requirements For part A, you must use functions to accomplish this task, when displaying data to the command window you must use fprintf. function. When dealing with the structure array keep all data as a structure array and do not convert it to a cell array or matrix. Please use the provided skeleton code as your starting point. Also, when submitting your solution there is only 1 file to be submitted, this file will contain all the functions to solve this assignment. Checklist: Did you save your data using your full name as the filename with the extension .mat? Did you create the plots? Did you include the titles and labels Did you display the data to the command window? Does is data match what is included in the screenshot (not including your Full name and CCID) Did you display the title along with your Full name and CCID? Did you use functions to solve this problem? Did you comment your code? Do you have descriptive variable names? Did you credit any student who helped you? Assignment 4 - Rev 1 Submission: For Rev 1 of this assignment, please submit your solution to eClass under Assignment 4R1. With the following naming convention: Assign4R1_.m Ex. CCID jmac filename will be Assign4R1 _jmac.m Rev 2 Problem and Program Details: We are building off of your work from Rev. 1, so copy and paste your solution from Rev 1 and rename it to Assign4R2_,m where is your CCID. Next, edit line 15, for i=1:31% For Rev 1 31, For Rev 2 size (Data, 2) to for i=1:size (Data, 2) For Rev 1 31, For Rev 2 size (Data, 2) Uncomment the these three lines in the main function Monthly=ConvertAndSum_Monthly (Totals); %PrintMonthlyData (Monthly); save ('_Monthly.mat', 'Monthly'); Edit the save command by adding your Full name before the underscore. ENCMP 100-Computer Programming for Engineers Page 6 of 6 Then create a new monthly summary of the created structure array into a new structure array where you have the following fields: Month, Year, Total number of steps, distance, floors, sleep, and average resting heart rate. Save this new summarized result as Monthly.mat You will need this data to display the monthly results to the command window. Then display the contents of the new structure array to the command window with a title and your name with your CCID. Along with the totals for the month of sleep, steps, distance, floors climbed, and average resting heart rate. Other stats that may be useful to the client are minimum, mean (or average) and maximum values of sleep, steps, and floors climbed. Your output should look similar to the output of Rev2.p Code requirements For part B, you must use functions to accomplish this task, when displaying data to the command window you must use fprintf. function. When dealing with the structure array keep all data as a structure array and do not convert it to a cell array or matrix. For part B, please continue working on the file created in part A, just rename the file along with the main function. Also, when submitting your solution there is only 1 file to be submitted, this file will contain all the functions to solve this assignment. Checklist: Did you save your data using your full name as the filename with the extension .mat? This should contain 365 rows of data Did you save your monthly totals using Monthly.mat as your filename, This should contain 12 row of data Did you create the plots? Did you include the titles and labels Did you display the data to the command window? Does is data match what is included in the screenshot (not including your Full name and CCD) Did you display the title along with your Full name and CCID? Did you use functions to solve this problem? Did you comment your code? Do you have descriptive variable names? Did you credit any student who helped you? Assignment 4-Rev 2 Submission: For Rev 2 of this assignment, please submit your solution to eClass under Assignment 4R2. With the following naming convention: Assign4R2_.m Ex. CCID jmac filename will be Assign4R2_jmac.m ENCMP 100-Computer Programming for Engineers Page 1 of 6 ENCMP 100 - Computer Programming for Engineers Assignment #4 Rev 2 Due: Friday, March. 19 2021 at 6:00pm MST Objective This assignment is designed to provide you with practice using functions to preform computations, and structure arrays to create and save data. You will develop a MATLAB program that utilizes functions to summarize a user's fitbit data. Marking Scheme You will get a total of 100 points for completing the following: POINTS 0 25 TASK Rev. 0 Fully functional program you are to produce Rev. 1 Get and display first 31 row of data working correctly using functions and structures Rev. 2 Get and display entire dataset using functions and structures Quality of code: 25 points per submission TOTAL 25 50 100 Points for Quality of Code Complete file header Design (appropriate use and naming of variables) Comments in the code Layout (indentation/spacing) Did you follow filename naming convention . C Submission Filename naming convention Assign4R1_.m Ex. CCID or email : jmac filename for assignment #4Revl is Assign4R1_jmac.m Submit only your .m file under Labs, Assignment 4Revl submission in your eClass Assignment Due on Friday March 19 2021 at 6:00pm MST Please thoroughly test your code to ensure functionality, and compare results to the included Rev 0 program. . ENCMP 100-Computer Programming for Engineers Page 2 of 6 Problem and Program Details: Rev 0 Getting Started You are tasked with providing a reader-friendly summary of a client's fitbit data. This will be an integral part of a report of the client's health and activity. Posted on eClass, under Lab 4 Information is a zip file containing four files: Data_Year.mat -> this is your data file which contains fitbit data for a year Assign4_ccid.m -> a template to work from Rev1.p -> Program outputs for Rev 1 of your code Rev2.p -> Program outputs for Rev 2 of your code Unzip the contents in to a directory or folder and work from that directory or folder. The data file and *.m file must be in the same directory or folder. Remember to rename the skeleton code filename with your CCID. To run the included Revl.p or Rev2.p, in Matlab, goto your current folder window where you have unzipped your files, right click on *p and select run. Review the outputs on the command window, and the files that are created after the program runs. Rev 1 Your objective is to create, and save a new structure array that contains the following items: Month - can be copied from the Data_Year.mat structure array Day- can be copied from the Data_Year.mat structure array Year - can be copied from the Data_ Year.mat structure array Steps - can be copied from the Data_Year.mat structure array Distance - to calculate this take the number of steps multiplied by 0.0006 to convert steps to kilometers Floors -- can be copied from the Data_ Year.mat structure array Sleep - you will need to add the Sleep and Nap values together to get the total hours slept. Please note the minutes field needs to be converted in to hours. Resting Heart Rate - can be copied from the Data_ Year.mat structure array When you save your structure array, use the save command and use your name as the filename with the extension *.mat Then display a graph of the following graphs from the data contained in the new structure array: Total sleep vs days Steps vs days Floors climbed vs days Resting HR (Heart Rate) vs days You should use the subplot function, along with the plot function Your chart should look similar to this: ENCMP 100-Computer Programming for Engineers Page 3 of 6 Sleep 104 Steps Floors Climbed 10 55 70 Resting HR 9 50 1.6 58 1.4 67 12 65 30 25 63 0.B 20 0.6 15 61 10 0.4 O 60 10 30 10 30 10 30 10 30 20 Days 20 Days 20 Days 20 Days Then display the contents of the new structure array to the command window with a title and your name with your CCID. Along with the totals for the month of sleep, steps, distance, and floors climbed. Other stats that may be useful to the client are minimum, mean (or average) and maximum values of sleep, steps, and floors climbed. Your output should look similar to this, when being marked, we are concerned with the data not formatting: ENCMP 100-Computer Programming for Engineers Page 4 of 6 2018 Resting HR 68 67 66 69 67 68 67 Jan. 68 69 69 70 68 >> Revl ENCMP100 Assignment #4A Fitness Data Display Anaylsed by Joe MacDonald (jmac) Month Day Year Steps Distance Floors Sleep Jan. 1 2018 5648 3.389 20 7.4667 Jan. 2 11260 6.756 29 4.9833 Jan. 3 2018 11224 6.734 34 1.2000 Jan. 2018 14851 8.911 32 8.1167 Jan. 5 2018 10502 6.301 17 8.9667 Jan. 6 2018 5033 3.020 17 7.0667 Jan. 7 2018 8908 5.345 20 4.7833 8 2018 11718 7.031 35 6.7500 Jan. 2018 14562 8.737 38 4.4833 Jan. 10 2018 10920 6.552 26 5.5667 Jan. 11 2018 10828 6.497 33 5.2833 Jan. 12 2018 14295 8.577 25 7.5333 Jan. 13 2018 5599 3.359 17 8.9000 Jan. 14 2018 5758 3.455 15 6.7500 Jan. 15 11650 6.990 42 4.6667 Jan. 16 2018 12428 7.457 28 6.7500 Jan. 17 2018 15732 9.439 36 6.0000 Jan. 18 2018 15304 9.182 27 6.4833 Jan. 19 2018 5975 3.585 14 8.9667 Jan. 20 2018 6410 3.846 13 8.5500 Jan. 21 2018 6701 4.021 28 5.0333 Jan. 22 2018 13384 8.030 50 3.1833 Jan. 23 2018 10680 6.408 43 4.9500 24 2018 11283 6.770 45 8.0833 Jan. 25 2018 17194 10.316 22 5.1000 Jan. 26 2018 6445 3.867 21 9.4333 Jan. 27 2018 6132 3.679 20 8.2167 Jan. 28 2018 6315 3.789 22 6.4833 Jan. 29 2018 11538 6.923 34 5.3667 Jan. 30 2018 13183 7.910 51 4.3667 Jan. 31 2018 11820 7.092 32 6.2833 67 67 2018 68 68 67 68 65 65 64 63 64 Jan. 64 67 65 62 60 60 62 Totals Steps 323280 Distance 193.968 Floors 886 Sleep (hours) 195.7667 Min values: Sleep (hours): 1.20 Steps: 5033.00 Floors climbed: 13.00 323280 193.968 886 195.7667 Min values: Sleep (hours): 1.20 Steps: 5033.00 Floors climbed: 13.00 Mean/Average values: Sleep (hours) : 6.32 Steps: 10428.39 Floors climbed: 28.58 Max values: Sleep (hours): 9.43 Steps: 17194.00 Floors climbed: 51.00 fx >> | ENCMP 100-Computer Programming for Engineers Page 5 of 6 Code requirements For part A, you must use functions to accomplish this task, when displaying data to the command window you must use fprintf. function. When dealing with the structure array keep all data as a structure array and do not convert it to a cell array or matrix. Please use the provided skeleton code as your starting point. Also, when submitting your solution there is only 1 file to be submitted, this file will contain all the functions to solve this assignment. Checklist: Did you save your data using your full name as the filename with the extension .mat? Did you create the plots? Did you include the titles and labels Did you display the data to the command window? Does is data match what is included in the screenshot (not including your Full name and CCID) Did you display the title along with your Full name and CCID? Did you use functions to solve this problem? Did you comment your code? Do you have descriptive variable names? Did you credit any student who helped you? Assignment 4 - Rev 1 Submission: For Rev 1 of this assignment, please submit your solution to eClass under Assignment 4R1. With the following naming convention: Assign4R1_.m Ex. CCID jmac filename will be Assign4R1 _jmac.m Rev 2 Problem and Program Details: We are building off of your work from Rev. 1, so copy and paste your solution from Rev 1 and rename it to Assign4R2_,m where is your CCID. Next, edit line 15, for i=1:31% For Rev 1 31, For Rev 2 size (Data, 2) to for i=1:size (Data, 2) For Rev 1 31, For Rev 2 size (Data, 2) Uncomment the these three lines in the main function Monthly=ConvertAndSum_Monthly (Totals); %PrintMonthlyData (Monthly); save ('_Monthly.mat', 'Monthly'); Edit the save command by adding your Full name before the underscore. ENCMP 100-Computer Programming for Engineers Page 6 of 6 Then create a new monthly summary of the created structure array into a new structure array where you have the following fields: Month, Year, Total number of steps, distance, floors, sleep, and average resting heart rate. Save this new summarized result as Monthly.mat You will need this data to display the monthly results to the command window. Then display the contents of the new structure array to the command window with a title and your name with your CCID. Along with the totals for the month of sleep, steps, distance, floors climbed, and average resting heart rate. Other stats that may be useful to the client are minimum, mean (or average) and maximum values of sleep, steps, and floors climbed. Your output should look similar to the output of Rev2.p Code requirements For part B, you must use functions to accomplish this task, when displaying data to the command window you must use fprintf. function. When dealing with the structure array keep all data as a structure array and do not convert it to a cell array or matrix. For part B, please continue working on the file created in part A, just rename the file along with the main function. Also, when submitting your solution there is only 1 file to be submitted, this file will contain all the functions to solve this assignment. Checklist: Did you save your data using your full name as the filename with the extension .mat? This should contain 365 rows of data Did you save your monthly totals using Monthly.mat as your filename, This should contain 12 row of data Did you create the plots? Did you include the titles and labels Did you display the data to the command window? Does is data match what is included in the screenshot (not including your Full name and CCD) Did you display the title along with your Full name and CCID? Did you use functions to solve this problem? Did you comment your code? Do you have descriptive variable names? Did you credit any student who helped you? Assignment 4-Rev 2 Submission: For Rev 2 of this assignment, please submit your solution to eClass under Assignment 4R2. With the following naming convention: Assign4R2_.m Ex. CCID jmac filename will be Assign4R2_jmac.m

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions