MatLab 3 Write a function to calculate the standard deviatio

MatLab

3. Write a function to calculate the standard deviation of a vector, where x, is the i-th element of the vector, x is the average of the vector n i l

Solution

Function y=stddeviation(x)

n=length(x);

av=sum(x)/n;

for I=1:1:n

X(i)=(x(i)-av).^2;

X(i)=x(i)/n;

y=sqrt(sum(x));

end

MatLab 3. Write a function to calculate the standard deviation of a vector, where x, is the i-th element of the vector, x is the average of the vector n i l Sol

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site