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

2 次查看(过去 30 天)
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

回答(1 个)

Jan
Jan 2018-5-30
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

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by