For loop for wind speed analysis
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
dpb
le 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.
Réponse acceptée
Voss
le 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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!