for loops for two variables (not nested loop)
Mostrar comentarios más antiguos
I've a .dat file with 73280 length. i'm trying to find mean of first 100 values, then mean of 101 to 200 values, then 201 to 300 and so on until last 100 values. 1st error i got was "Index exceeds matrix dimensions." I rounded off the length to 73200 and got rid of this problem.
x = [];
y = rms (a1,100); %a1 is original data
b= length(y);
c= b/100;
for i =1:100:b
x= [mean(y(i:i+99))]
end
subplot (2,2,1); plot (t1, a1)
subplot (2,2,2); plot (x)
subplot (2,2,3); plot (t1,y)
the value of "x" is updating in every iteration. what i want is to store the every value of "x" and then plot it.
1 comentario
UET Hussain
el 30 de Nov. de 2017
Editada: Stephen23
el 30 de Nov. de 2017
Respuesta aceptada
Más respuestas (1)
M
el 30 de Nov. de 2017
You can use
x=[x mean(y(i:i+99))];
1 comentario
UET Hussain
el 30 de Nov. de 2017
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!