plot mean of vector v(1:i)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Thales
am 11 Dez. 2018
Bearbeitet: Stephen23
am 11 Dez. 2018
For simplicity, I have the following code
v=1:10;
for i=1:10
mean_v(i) = mean(v(1:i));
end
plot(v,mean_v)
In essence, I want to plot the mean of the vector from elements 1 to i, as a function of the i-index. Any way I could do it in one line?
plot(v,mean(v(1:?)))
What should I change in the mean(v(1:?)) part?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots 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!