Stats

Popular Posts

Followers

Mathematica 教學 一串數列不同間隔取平均

戴忠淵 於 2012年11月8日星期四 上午8:01 發表


 作者  lazycowbay (輕鬆過生活~)                                  看板  MATLAB  標題  [討論] 一串數列取平均的問題  時間  Tue Nov  6 16:16:00 2012 ───────────────────────────────────────  我有一個(1,520)的數列  我必須每3筆 3筆 3筆 4筆做平均  然後再3,3,3,4 一直循環做平均到最後  最後會得到(1,40)的數列  請問一下大家 我可以怎麼取呢?

(* 先將520個元素分割為每個14的子陣列,再分別取平均 *)

Map[Mean,{#[[1;;3]],#[[4;;6]],#[[7;;10]],#[[10;;-1]]}]&/@
Partition[Range[520],13]

Tags: ,

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~