フィルターのクリア

Obtain the mean angle (circle mean of a file)

16 ビュー (過去 30 日間)
Ana Soph
Ana Soph 2020 年 8 月 5 日
編集済み: Bruno Luong 2020 年 8 月 5 日
Hi, first of all, thank you for reading me, i need something very simple but i can't find a good program to do this...
The average of wind direction data.
i am using matlab 2019a, and have all this data (for a year) and i need the average of this data (attach photo) for every row (this data are in degree, so this not regular mean is circle mean that i need) , so every 10 minutes, so in the end i want to have only one column, i am using meanangle, but i don't obtain good results. don't obtain good results.
if you can help me I would appreciate it too much

採用された回答

Bruno Luong
Bruno Luong 2020 年 8 月 5 日
編集済み: Bruno Luong 2020 年 8 月 5 日
angledata_deg is your angle data in degree
meanangle_deg = rad2deg(atan2(mean(sind(angledata_deg),2),mean(cosd(angledata_deg),2)))
  3 件のコメント
Bruno Luong
Bruno Luong 2020 年 8 月 5 日
編集済み: Bruno Luong 2020 年 8 月 5 日
Normal, since atan2 returns angle in [-pi,pi] so it can be negative, if you prefer angle in [0,2*pi]
do this after the first command.
meanangle_deg = mod(meanangle_deg ,360)
Ana Soph
Ana Soph 2020 年 8 月 5 日
thank you so much :D

サインインしてコメントする。

その他の回答 (2 件)

Jessica Langsdale
Jessica Langsdale 2020 年 8 月 5 日
%enter the number of rows here
arraySize=5;
meanData=zeros(arraySize,1)
for i=1:5
meanData(i)=mean(originalData(i,:))
end
Replace all the variables with your stuff. I think this is what you need? I'm not quite sure what you mean by 'circle mean' but this fits the description of the second half of your question.
  1 件のコメント
Ana Soph
Ana Soph 2020 年 8 月 5 日
But i need the circle mean, not the regular mean, because are degree

サインインしてコメントする。


KSSV
KSSV 2020 年 8 月 5 日
num = xlsread(myfile) ; % better use readtable
iwant = mean(num,2) ;
  3 件のコメント
KSSV
KSSV 2020 年 8 月 5 日
What is circle mean? Your units are in degrees, your mean value will be in degrees.
Ana Soph
Ana Soph 2020 年 8 月 5 日

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxes Transformations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by