to use MAILAАB tо collect anа апaiyze the аata. As you are conducing the exp TLAB to prompt you to enter the data for each trial. Once you finish collecting, to automatically calculate some important metrics. reate a MATLAB function called enter_data.m. The function will take in a hich is the number of experimental trials. The function should then prompt the u enter the name of the trial (character array, EX: 'test 1') b. first measurement (double floating point, EX: 3.567) c. second measurement (double floating point, EX: 3.337) а. thied (doubl. TY. 2 110)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Part B - Write your own MATLAB Functions & Sub-functions
Function purpose: You are working in the lab on an experiment where you are gathering a lot of data.
You want to use MATLAB to collect and analyze the data. As you are conducting the experiment, you
want MATLAB to prompt you to enter the data for each trial. Once you finish collecting, you want
MATLAB to automatically calculate some important metrics.
1. Create a MATLAB function called enter_data.m. The function will take in a single input,
which is the number of experimental trials. The function should then prompt the user to:
a. enter the name of the trial (character array, EX: 'test 1')
b. first measurement (double floating point, EX: 3.567)
c. second measurement (double floating point, EX: 3.337)
d. third measurement (double floating point, EX: 3.110)
e. Each of these fields should then be an element in a row of a cell array. Your function
should return a single variable, which is a cell array that contains all the information about
all the data entered, each trial's information should be on a separate row.
2. Create a second MATLAB function called calc_stats.m that can receive the data from part 1
above as an input. Then, it creates two outputs:
a. A single array that contains the averages (across all trials) for each of the three
measurements. This array will always be 3 elements big.
b. A single array that contains a calculated metric based on the weighted sum of all three
measurements. For each trial you will calculate:
m=0.2*m1+0.2*m2+0.4*m3
where ml is the first measurement, m2 is the second measurement, and m3 is the third
measurement. You can choose to do the calculation in a loop or using vectorized notation.
**For both of these calculations, you will need use the {} notation to access the values of
the cell array.
3. Create a third MATLAB function called L2_b_Section#_Lastname_Firstname.m'. There will be
no inputs and no outputs to this main function. The first line of code should be to call your
enter_data function, the input should be 2 trials and average the output array as data2. The
second line of code should be to call your calc_stats function with data2 as the input. Save
the two outputted arrays to two new variables. Display the final metrics to the screen in a useful
way.
Transcribed Image Text:Part B - Write your own MATLAB Functions & Sub-functions Function purpose: You are working in the lab on an experiment where you are gathering a lot of data. You want to use MATLAB to collect and analyze the data. As you are conducting the experiment, you want MATLAB to prompt you to enter the data for each trial. Once you finish collecting, you want MATLAB to automatically calculate some important metrics. 1. Create a MATLAB function called enter_data.m. The function will take in a single input, which is the number of experimental trials. The function should then prompt the user to: a. enter the name of the trial (character array, EX: 'test 1') b. first measurement (double floating point, EX: 3.567) c. second measurement (double floating point, EX: 3.337) d. third measurement (double floating point, EX: 3.110) e. Each of these fields should then be an element in a row of a cell array. Your function should return a single variable, which is a cell array that contains all the information about all the data entered, each trial's information should be on a separate row. 2. Create a second MATLAB function called calc_stats.m that can receive the data from part 1 above as an input. Then, it creates two outputs: a. A single array that contains the averages (across all trials) for each of the three measurements. This array will always be 3 elements big. b. A single array that contains a calculated metric based on the weighted sum of all three measurements. For each trial you will calculate: m=0.2*m1+0.2*m2+0.4*m3 where ml is the first measurement, m2 is the second measurement, and m3 is the third measurement. You can choose to do the calculation in a loop or using vectorized notation. **For both of these calculations, you will need use the {} notation to access the values of the cell array. 3. Create a third MATLAB function called L2_b_Section#_Lastname_Firstname.m'. There will be no inputs and no outputs to this main function. The first line of code should be to call your enter_data function, the input should be 2 trials and average the output array as data2. The second line of code should be to call your calc_stats function with data2 as the input. Save the two outputted arrays to two new variables. Display the final metrics to the screen in a useful way.
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY