フィルターのクリア

Writing a code for taking harmonic averaging at a point

1 回表示 (過去 30 日間)
Mayowa
Mayowa 2014 年 11 月 5 日
回答済み: Star Strider 2014 年 11 月 5 日
I have vector of 10x1. Say 1-10. I want to take harmonic average at a particular point say 5. I want the average to be done in such a way that it will take 2 values on top and below 5 and add 5 itself making a total of 5 samples. How can I write a code for this on matlab?
That is average=(1/3 + 1/4 + 1/5 + 1/6 + 1/7)/5

採用された回答

Star Strider
Star Strider 2014 年 11 月 5 日
Using only core MATLAB functions:
x = 1:10; % Data
mpx = 5; % Midpoint
rngx = 1./x(mpx-2:mpx+2); % Data Range
mx = mean(rngx); % Result

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by