How to find the actual value of d,b,t and D in the maximum value of sac?

1 view (last 30 days)
close all
clear all
clc
% Constants
c = 340; % Speed of sound
rho = 1.204; % Air Density
n = 1.825e-5; % dynamics viscosity
w = 3000*pi;
% Loop
for d=1:1:10
for t=50:10:200
for b=10:10:200
for D=10:10:800
sac(d,t,b,D) = (4*(32*n.*(t*10^-4)/((78.5*(d*10^-4).^2/(b*10^-4).^2)*rho*c*(d*10^-4).^2))*((sqrt(1+((d*10^-4)*sqrt(w*rho/(4*n)).^2/32)))+((sqrt(2)/32)*(d*10^-4)*sqrt(w*rho/(4*n))*(d*10^-4)./(t*10^-4))))./(((1+(32*n.*(t*10^-4)/((78.5*(d*10^-4).^2/(b*10^-4).^2)*rho*c*(d*10^-4).^2))*((sqrt(1+((d*10^-4)*sqrt(w*rho/(4*n)).^2/32)))+((sqrt(2)/32)*(d*10^-4)*sqrt(w*rho/(4*n))*(d*10^-4)./(t*10^-4)))).^2)+((w.*(t*10^-4))/((78.5*(d*10^-4).^2/(b*10^-4).^2)*c).*(1+(1./(sqrt(3^2+(((d*10^-4)*sqrt(w*rho/(4*n)).^2)/2))))+(0.85*((d*10^-4)./(t*10^-4))))-cot(w*(D*10^-4)/c)).^2);
end
end
end
end
M = max(sac(:));

Answers (1)

Torsten
Torsten on 27 Nov 2022
Edited: Torsten on 27 Nov 2022
close all
clear all
clc
% Constants
c = 340; % Speed of sound
rho = 1.204; % Air Density
n = 1.825e-5; % dynamics viscosity
w = 3000*pi;
% Loop
sacmax = -Inf;
indmax = zeros(1,4);
for d=1:1:10
for t=50:10:200
for b=10:10:200
for D=10:10:800
sac = (4*(32*n.*(t*10^-4)/((78.5*(d*10^-4).^2/(b*10^-4).^2)*rho*c*(d*10^-4).^2))*((sqrt(1+((d*10^-4)*sqrt(w*rho/(4*n)).^2/32)))+((sqrt(2)/32)*(d*10^-4)*sqrt(w*rho/(4*n))*(d*10^-4)./(t*10^-4))))./(((1+(32*n.*(t*10^-4)/((78.5*(d*10^-4).^2/(b*10^-4).^2)*rho*c*(d*10^-4).^2))*((sqrt(1+((d*10^-4)*sqrt(w*rho/(4*n)).^2/32)))+((sqrt(2)/32)*(d*10^-4)*sqrt(w*rho/(4*n))*(d*10^-4)./(t*10^-4)))).^2)+((w.*(t*10^-4))/((78.5*(d*10^-4).^2/(b*10^-4).^2)*c).*(1+(1./(sqrt(3^2+(((d*10^-4)*sqrt(w*rho/(4*n)).^2)/2))))+(0.85*((d*10^-4)./(t*10^-4))))-cot(w*(D*10^-4)/c)).^2);
if sac > sacmax
sacmax = sac;
indmax = [d,t,b,D];
end
end
end
end
end
sacmax
sacmax = 1.0000
indmax
indmax = 1×4
4 80 20 540

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!