Problem 4: Use a MATLAB command to determine the number of rows and columns in t
ID: 3770947 • Letter: P
Question
Problem 4: 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
Explanation / Answer
% let l be the Given Array
[x,y] = size (l)
for i = 1:x
am = 0.0;
for j = 2:6
am += l(i,j);
end
fprintf("Average for each time is %f",am/5);
l(i,7) = am/5;
end
% mean and standard deviation for each sensor
for j = 2:6
sum = 0.0
for i = 1:x
sum += l(i,j);
% put formula for standard deviation here
end
fprintf("Means for each sensor is %f ",sum/x);
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.