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

15 ビュー (過去 30 日間)
Ornella Fanais
Ornella Fanais 2018 年 5 月 30 日
回答済み: Jan 2018 年 5 月 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 Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by