필터 지우기
필터 지우기

average and standard deviation

조회 수: 2 (최근 30일)
Michael
Michael 2014년 10월 16일
답변: Image Analyst 2014년 10월 17일
I need help writing a program that computes and returns the average and standard deviation of the elements in a vector x, without using the built in mean and std functions.

답변 (1개)

Image Analyst
Image Analyst 2014년 10월 17일
It's just a simple for loop to sum the variable.
theSum = 0;
for k = 1 : length(x)
theSum = theSum + x(k);
end
theMean = theSum / length(x);
For the SD, it's very very similar - try it yourself this time. If you need to learn MATLAB, check this out: http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by