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

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

Antworten (1)

Jan
Jan am 30 Mai 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

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Mai 2018

Beantwortet:

Jan
am 30 Mai 2018

Community Treasure Hunt

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

Start Hunting!

Translated by