Generating multiple max values from various data sets
Ältere Kommentare anzeigen
Hello,
At the moment my code reads through 37 data sets and grabs the max of each spradsheet and outputs the max pressure readings from each of the sheets for 31 points. So at the end I have 31 columns and 37 rows.
I am trying to alter the code so it would give me an output of the top 10 peaks of each instead of 1 for each point. That way I am able to take an average of it all.
I am struggling to sort the values and make it output the 10 for each file. I can't use maxk because I am using an older version.
This is my code at the moment.
Temp = xlsread('C;\Temperature Data.xlsx','B:B');
angle = 0:10:360;
nports = 64;% including the two ports for the reference Pitot static tube
Uinf = zeros(length(angle),1);
Max = zeros(length(angle),(nports-2)/2);
for ii = 1:length(angle)
load(['20200401_Existing_',num2str(angle(ii)),'.mat']); % loading the mat file -
% Note: if you are using windows machine, use backward slash in the folder address
rho = 101325./((Temp(ii) + 273.15)*286.9); % ideal gas equation
Uinf(ii) = sqrt(mean(2*abs(data{:,2}-data{:,3}))./rho); % free stream velocity
press = sqrt(2*abs(data{:,4:2:end}-data{:,5:2:end})./rho)./Uinf(ii);
Max(ii,:) = max(press,[],1); % Maximum of pressure fluctuations
end
xlswrite('Test_Max',Max);
Thank you,
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
