Matlab Given x 7 6 1 2 0 1 4 3 2 0 what are the commands th
Matlab
Given x = [7, 6, 1, 2, 0, -1, 4, 3, -2, 0] what are the commands that will execute the following operations: Set the values of x that are less than the mean to zero. x(xSolution
Mean function :
MATLAB function to find mean is mean(x).
Example program :
Set the values in x that are less than the mean to zero
x=[7 6 1 2 0 -1 4 3 -2 0];
n=length(x); // Here length is 10
for i=1:n if x(i)< mean(x) // loop runs from i value 1 to n and check x(i)< mean(x)
x(i)=0; // Here set the values in x that are less than the mean to zero
end
end
x
Observe the options :
Option 3 is correct choice.
![Matlab Given x = [7, 6, 1, 2, 0, -1, 4, 3, -2, 0] what are the commands that will execute the following operations: Set the values of x that are less than the m Matlab Given x = [7, 6, 1, 2, 0, -1, 4, 3, -2, 0] what are the commands that will execute the following operations: Set the values of x that are less than the m](/WebImages/30/matlab-given-x-7-6-1-2-0-1-4-3-2-0-what-are-the-commands-th-1086395-1761571325-0.webp)
