How can i calculate mean wind direction(in degrees) from 1 minute to 10 minutes?

Hi everybody, i have a problem, i have a 1 min data of the wind direction(in degrees) of 3 months, but i want the average every 10 minutes of this data.
I have the matlab 2015, so .. i can't use circ.mean.
Can you help me with that, please?
Thank you in advance
Best!!!

2 Commenti

What is "circ.mean" ?
What form is the time information in? Or is it safe to assume that the data definitely starts on an even 10 minute boundary and is definitely every 1 minute?
hi, thanks for answering, about your questions...
  1. circ_mean is Mean direction of a sample of circular data (this is what i need)
  2. Yes, is safe to assume that the data definitely starts on an even 10 minute boundary and is definitely every 1 minute
i am waiting your answer, thanks (:

Accedi per commentare.

 Risposta accettata

The final script is:
M = xlsread('Dic2019','Dic2019mat')
ten_minute_avarege = meanangle(reshape(M, 10, []), 'omitnan')
A = ten_minute_avarege';
for i=1:length(A)
if A(i)<0, A(i)=A(i)+360; end
end
A = A(:,1);
A = reshape(A,144,length(A)/144);
xlswrite('datosexcel1.xlsx', A', 'Hoja1', 'A1')
thanks all! :D

8 Commenti

? I was not able to find any meanangle() function that access 'omitnan' as an option?
I see. Hacking based on the fact that the code does not check whether the dimension number it is passed is reasonable.
It looks like it will work. It might confuse readers, so I recommend commenting it why it works.
Ok ok, i understand, the reason that i think it works is because i use values that i now the answer and use the program. So, i validate random intervals of numbers too, but i don't sure that is enough, i am very new in matlab
It should work with numeric values, including values that might include nan.
It just is not an intended way of calling meanangle. But it will work because meanangle was sloppy in not checking that the parameters were what the function expected.

Accedi per commentare.

Più risposte (1)

If you can be sure that the data starts on a 10-minute boundary and that there is no missing data, then
ten_minute_avarege = mean(reshape(WindData, 10, []), 'omitnan')
If you are sure you have no nan entries, then you can leave out the 'omitnan'

8 Commenti

but the data is in degrees... i need the mean of a set of angles (in degrees) based on polar considerations.
yes, is true, but i have matlab 2015, and can't use in this matlab that function :c
What error message do you get when you try to use the function?
I just tried in R2015a and had no problem using the circ_mean function from that File Exchange Contribution.
really? omg!; i have this error: Undefined function or variable 'circ_mean'.
this is my code
M = xlsread('Dic2019','Dic2019mat')
ten_minute_avarege = circ_mean(reshape(M, 10, []), 'omitnan')
xlswrite('datosexcel1.xlsx', ten_minute_avarege, 'Hoja1', 'A1');
You have to download the code from the File Exchange, and unzip it into its own directory that is not under the MATLAB installation directory. Then use pathtool to add that directory to the path, and save.

Accedi per commentare.

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by