Filter löschen
Filter löschen

average and standard deviation

2 Ansichten (letzte 30 Tage)
Michael
Michael am 16 Okt. 2014
Beantwortet: Image Analyst am 17 Okt. 2014
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.

Antworten (1)

Image Analyst
Image Analyst am 17 Okt. 2014
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

Kategorien

Mehr zu Code Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by