plot for different value of movmean(X,k) with a for loop

2 visualizaciones (últimos 30 días)
Ornella Fanais
Ornella Fanais el 30 de Mayo de 2018
Respondida: Jan el 30 de Mayo de 2018
Hi!! I have to create a graphs using this function movemean(X,k) where X is my vector for example Y=[1;2;4;5;6] and k is the rate that I would like to change. Infact, I would like to create a subplot with a different value of k. I make this: subplot(2,1,1),plot(movmean(e,2),movmean(sigma,2)),grid subplot(2,1,2),plot(movmean(e,5),movmean(sigma,3)),grid subplot(2,1,3),plot(movmean(e,5),movmean(sigma,4)),grid subplot(2,1,4),plot(movmean(e,5),movmean(sigma,5)),grid But I would like to make with a for loop, without changing manually the value of k. thanks for your help

Respuestas (1)

Jan
Jan el 30 de Mayo de 2018
If you want a loop, use a loop:
for k = 1:4
subplot(2,1,k);
plot(movmean(e, k + 1), movmean(sigma, k + 1))
grid('on');
end

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by