How to obtain the minimum values of an array?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Oscar Espinosa
le 8 Juin 2019
Commenté : Oscar Espinosa
le 10 Juin 2019
I'm trying to get the minimum values of three vectors. Assuming that the length of the vectors is 1x4, I need to get 4 minimums. Also one of the vectors has as values a constant. I'm attaching the code. The important part is on lines 12 to 15.
function [x_t,Re,eta_c,C_f] = CXAPWING(b,b_slats,x_thickness,x_camber,M)
%%% Коэффициент профильного сопротивления крыла
h_polish = 1e-6; %micro
V = M*299.45;
Re = V*b/3.5232e-5;
F1 = 1.3+0.6*M*(1-0.25*M^2);
hbRe = h_polish*V/3.5232e-5;
F2 = log10(abs(hbRe-1));
F3 = (2.2-0.08*M^2)/(1+0.312*M);
n = 5+F1*(1-(F2/F3)^2)^0.5;
x_t_1 = 10^n/Re;
x_t_2 = sqrt(x_thickness*x_camber);
x_t_3 = b_slats/b;
x_t = min([x_t_1 x_t_2 x_t_3]);
if Re < 4.85e5
C_f = 1.328/sqrt(Re);
elseif Re > 3e7
C_f = 0.455/(log10(Re))^2.58;
else
C_f = (0.455./log10(Re).^2.58).*((1-x_t+(40*x_t^0.625)/Re.^0.375).^0.8)';
end
% nc_xt = [1.4072 1.3722 1.3536 1.3103 1.2557; 0 0.1 0.2 0.3 0.4]; % 0.11
nc_xt = [1.3323 1.3063 1.2917 1.2552 1.2115; 0 0.1 0.2 0.3 0.4]; %0.09
if x_t > 0 && x_t < 0.1
eta_c = INTERPOLATION(nc_xt(2,1),nc_xt(1,1),nc_xt(2,2),nc_xt(1,2),x_t);
elseif x_t > 0.1 && x_t < 0.2
eta_c = INTERPOLATION(nc_xt(2,2),nc_xt(1,2),nc_xt(2,3),nc_xt(1,3),x_t);
elseif x_t > 0.2 && x_t < 0.3
eta_c = INTERPOLATION(nc_xt(2,3),nc_xt(1,3),nc_xt(2,4),nc_xt(1,4),x_t);
else x_t > 0.3 && x_t < 0.4
eta_c = INTERPOLATION(nc_xt(2,4),nc_xt(1,4),nc_xt(2,5),nc_xt(1,5),x_t);
end
end
0 commentaires
Réponse acceptée
madhan ravi
le 8 Juin 2019
Have a look at mink() else use sort() and pick the first four values if you’re using older version.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!