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

Problem 4: Import the data from the file proj5.mat. Use a MATLAB command to dete

ID: 3770926 • Letter: P

Question


Problem 4: Import the data from the file proj5.mat. Use a MATLAB command to determine the number of rows and columns in the array. Column 1 contains time values, columns 2 through 6 contains the data from 5 sensors (each sensor in one column) for each time. Without creating any arrays that are a subset of the sensor array (otherwise you will lose all the points for this questions) perform the following tasks: determine the average of the sensor readings for each time (do not include the time values in the average calculation), add the average values to the sensor array to create column 7 of the array, calculate the mean and standard deviation for each sensor, calculate the mean and standard deviation for all the sensors readings.

Use matlab for this. I have a data file that works for this so if you could just figure out a solution that would be appricated.

Explanation / Answer

Another less compact approach finds the max values for each column at first:

If X is a scalar, then size(X) returns the vector [1 1]. Scalars are regarded as a 1-by-1 arrays in MATLAB®.

If X is a table, size(X) returns a two-element row vector consisting of the number of rows and the number of variables in the table. Variables in the table can have multiple columns, but sizeonly counts the variables and rows.

[m,n] = size(X) returns the size of matrix X in separate variables m and n.

m = size(X,dim) returns the size of the dimension of X specified by scalar dim.

[d1,d2,d3,...,dn] = size(X), for n > 1, returns the sizes of the dimensions of the array X in the variables d1,d2,d3,...,dn, provided the number of output arguments n equals ndims(X). If ndoes not equal ndims(X), the following exceptions hold:

n < ndims(X)

di equals the size of the ith dimension of X for 0<i<n, but dn equals the product of the sizes of the remaining dimensions of X, that is, dimensionsn through ndims(X).

n > ndims(X)

size returns ones in the "extra" variables, that is, those corresponding to ndims(X)+1 through n.

n < ndims(X)

di equals the size of the ith dimension of X for 0<i<n, but dn equals the product of the sizes of the remaining dimensions of X, that is, dimensionsn through ndims(X).

n > ndims(X)

size returns ones in the "extra" variables, that is, those corresponding to ndims(X)+1 through n.