I have a file named SENSOR.DAT that I can email you if you are able to help. Wit
ID: 3545295 • Letter: I
Question
I have a file named SENSOR.DAT that I can email you if you are able to help. With this data I need to...
(a) write a program to preprocess the sensor data so that all the values that are greater than 10.0 are set to 10.0, and al the vales less than -10.0 are set to -10.0
(b) write a program to print the subscrips of sensor data values with absolute values greater than 20.0
(c) write a program to print the percentage of sensor data values that are 0
please let me know if you can help and we can contact eachother through email.
Explanation / Answer
% Assign absolute values from sensor to temp
temp=abs(sensor);
%Print the indices of sensor values > 20
find(temp>20)
%Initialise a temporary variable flag
flag=0;
%Find number of values > 20
a=1;
while(a<=i)
if(temp(a)>0)
flag=flag+1;
end
a=a+1;
end
% Calculate and print the percentage
disp(sprintf('Number of values > 20 = %i',flag));
per=flag/i*100;
disp(sprintf('Percentage data = %f ',per));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.