Info

This question is closed. Reopen it to edit or answer.

How to optimize some functions?

2 views (last 30 days)
Ana Reis
Ana Reis on 1 Oct 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hey guys,
So, I need to found the minimun values of Z and W when my parameters [pmax, pmin, td, tm] = [57086.00, 15420.247, 0.002026].
Restrictions: 0.2<=Z<= 39 and W>=0.1
Can you help me? I really don't know how can I optmizete those functions. Suggestion of command in matlab?
Thank you!
% Input Data
% Z = 5;
% W = 10;
% Positive Phase
if (0.07071 < Z && Z <= 0.1895)
pmax = 1000000 * 26.303 * Z^(-1.226);
elseif (0.1895 < Z && Z <= 0.48735)
pmax = 1000000 * 13.015 * Z^(-1.637);
elseif (0.48735 < Z && Z <= 1.096)
pmax = 1000000 * 8.1 * Z^(-2.322);
elseif (1.096 < Z && Z <= 2.418)
pmax = 1000000 * 8.0956 * Z^(-2.943);
elseif (2.418 < Z && Z <= 5.442)
pmax = 1000000 * 4.9419 * Z^(-2.427);
elseif (5.442 < Z)
pmax = 1000000 * 0.8645 * Z^(-1.411);
end
% ----------------------------------------------------------------------- %
% Negative Phase
if (Z <= 0.7)
A = 0; B = 0; C = 0; D = 100E-3;
elseif (Z > 0.7) && (Z <= 1.469)
A = -29.078E-3; B = 2; C = 0.0352E-3; D = 114E-3;
elseif (Z > 1.469) && (Z <= 2.754)
A = 84.132E-3; B = -1.286; C = 0; D = 0;
elseif (Z > 2.754)
A = 59.559E-3; B = -0.945; C = 0; D = 0;
end
pmin = double(10^6 * (( A * ( Z ^ B ) )...
+ ( C * Z ) + D));
% ----------------------------------------------------------------------- %
% Positive Time
if (0.20993 < Z && Z <= 1.0355)
td = 0.001 * ( 2.2064 * Z^3 - 0.3363 * Z^2 - ...
0.5644 * Z + 0.3756 ) * ( W^(1/3) );
elseif (1.0355 < Z && Z <= 1.49339)
td = 0.001 * ( 8.2395 * Z^3 - 34.896 * Z^2 + ...
48.909 * Z - 20.496 ) * ( W^(1/3) );
elseif (1.49339 < Z && Z <= 4.001)
td = 0.001 * ( -0.2695 * Z^3 + 2.3907 * Z^2 - ...
6.1005 * Z + 6.8329 ) * ( W^(1/3) );
elseif (4.001 < Z)
td = 0.001 * ( 1.5602 * log(Z) +1.2416 ) * ...
( W^(1/3) );
end
% ----------------------------------------------------------------------- %
% Negative Time
if (0.0717 < Z && Z <= 0.1985)
id = 1000 * ( 0.4352 * Z^( -1.949 ) ) * ...
( W^(1/3) );
elseif (0.1985 < Z && Z <= 1.2895)
id = 1000 * ( 0.8709 * Z^( -1.501 ) ) * ...
( W^(1/3) );
elseif (1.2895 < Z)
id = 1000 * ( 0.7805 * Z^( -1.104 ) ) * ...
( W^(1/3) );
end
% disp([' Peak reflect overpressure = ' num2str(pmax) ' Pa']);
% disp([' Peak reflect subpressure = ' num2str(pmin) ' Pa']);
% disp([' Time of positive phase = ' num2str(td) ' s']);
% disp([' Impulse of positive phase = ' num2str(id) ' Pa.s']);

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!