non linear constrain to solve for Squential Quadratic Programing

1 view (last 30 days)
Dai Nguyen
Dai Nguyen on 20 May 2021
Commented: Dai Nguyen on 20 May 2021
Hi I'm trying to minimize the volume of an object with these non linear constraints. How can I put it in my code\
constraints
c(1)= L + R - 131.23; % height of tank
c(2) = 1224.303*RL(1)^2; % height of distance, fuel needed
c(3) = (RL(1)*RL(2))/(2*(RL(2)+RL(1)))- 0.25; % thickness of tank
this is the code
% NOTE: RL(1) is R and RL(2) is L.
V =@(RL) pi*RL(1).^3 + pi*RL(1).^2*RL(2);
Rb = [157,147];
% NOTE: 157<=R<=173; 147<=L<=180; Thus, Rb= [157,147]; and Lb = [173, 180];
Lb = [173, 180];
% No Other constraints are considered here-need to put the constraint
A = [];
b = [];
Aeq = [];
beq = [];
x0 = (Lb + Rb)/2;
RL = fmincon(V,x0,A,b,Aeq,beq,Lb,Rb);
R = RL(1);
L = RL(2);
fprintf('Found values: R = %f [ft] L = %f [ft] \n', [R, L])

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by