Filter löschen
Filter löschen

For loop for wind speed analysis

2 Ansichten (letzte 30 Tage)
Ben Hatrick
Ben Hatrick am 5 Jan. 2022
Kommentiert: Ben Hatrick am 6 Jan. 2022
Hello, I am currently working on a data set from a wind turbine. I have calculated the values of wind speed and power output given as u_A & P_A respectively in the code below. I want to split the data into 25 sections that are 1 m/s wide and find the average wind speed and output power from 0m/s till 25m/s (cut-off speed of turbine). I know i need to iterate the process to do this but am not sure were to start. The code I have used so far is found below.
u_list = (u_lower <= u_A) & (u_A < u_upper);
u = u_A(u_list);
P = P_A(u_list);
This works as the wind speed and energy production vectors are paired with respect to their indices and so finding the postion of the relevant velocity will also give the power output. I am looking for a way to change the upper and lower bounds in steps of 1 until u_upper = 25 and find the mean and stanard deviation within each bound. Any help would be much appreciated!.
  1 Kommentar
dpb
dpb am 5 Jan. 2022
See
doc discretize % and friends
Also if you'll use a table object to hold the data,
doc groupsummary
will probably let you do all you wish in just a few lines of code.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Voss
Voss am 5 Jan. 2022
u_lower = 0:25;
N = numel(u_lower)-1;
u_mean = NaN(1,N);
u_std = NaN(1,N);
p_mean = NaN(1,N);
p_std = NaN(1,N);
for i = 1:N
u_list = (u_lower(i) <= u_A) & (u_A < u_lower(i+1));
if ~any(u_list)
continue
end
u = u_A(u_list);
P = P_A(u_list);
u_mean(i) = mean(u);
u_std(i) = std(u);
p_mean(i) = mean(P);
p_std(i) = std(P);
end

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by