Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB Two sets of data are given A test set: x y 1 4 2 5 3 8 And a set of exper

ID: 3938308 • Letter: M

Question

MATLAB

Two sets of data are given

A test set:

x

y

1

4

2

5

3

8

And a set of experimental data:

Time (s)

Velocity (m/s)

1

10.00

2

16.30

3

23.00

4

27.50

5

31.00

6

35.60

7

39.00

8

41.50

9

42.90

10

45.00

11

46.00

12

45.50

13

46.00

14

49.00

15

50.00

Function getData: In this function you will start by hardcoding the test data above into two 1D arrays. The input parameters to the function will be void (that is, no input) and the output will be the two arrays defined in the function. Once you have your program working, you can then substitute in the experimental data above. You will want to define arrays of zeros to pre-allocate space for your arrays.

x

y

1

4

2

5

3

8

Explanation / Answer

Here is the function

function [ t_set, e_set ] = func_hardcode( )


t_set=[4,5,8];
t_set=t_set';

e_set=[10.00,16.30,23.00,27.50,31.00,35.60,39.00,41.50,42.90,45.00,46.00,45.50,46.00,49.00,50.00];
e_set=e_set';
end

here is how you use this function

test_set = zeros(3,1);

exp_set = zeros(15,1);
[test_set,exp_set]=func_hardcode;