I have a variance question, however, my code isn't bringing up this in the command window when i try to run it. "Function definition are not supported in this context".
Ältere Kommentare anzeigen
function s2 = samplevar(x)
n=length(x); %sample size
q=mean(x);% mean of vector
for x=2:n
s2= sum((x-q)^2)/(n-1); formula for sample variance
end
x =[3,5,6,7,8,10]; example of a vector
samplevar(x) output
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Regression finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!