필터 지우기
필터 지우기

Minimization and Optimization. Minimize output by optimizing inputs

조회 수: 7 (최근 30일)
Anand Ra
Anand Ra 2021년 10월 6일
댓글: Anand Ra 2021년 10월 11일
Hello
Trying to minimize the output by finding the optimium input values. I am unable to construct the minimization part of the code with the constrains I have. Any help would be greatly appreciated.
% Objective:Optimize the lengths to minimze the power using a new variable.
a = 0.1:20;
b = 0.1:20;
d = a + 0.1:20;
c = b + 0.1:20;
e = d + 0.1:20
%Constants
k= 2;
w=1;
v=1.5
%Variables and their constrains
AB = sqrt(a.^2 + b.^2);
BC = sqrt( c.^2 + ((e-d)/2).^2 );
CS = sqrt( c.^2 + ((e-d)/2).^2 );
VAB = sqrt(((((a.*v).^2/(((b.^2).*4))) + (v^2)/2 )));
% VBS = sqrt(((a*v)^2/((4*b*b)) + (v^2)/2 ));
VCS = ((2*c)./(e-d)).*sqrt(AB.^2);
VBC= CS.^2 + BC.^2;
%Actual Power
%P = (AB.*VAB + BC.*VBC + CS.*VCS).*k*w; % Power
%
% Objective
%To search and find the values for a, b, c d and e to minimize power (P)
% Not sure how to write the function for above
% fun = @(x)(x(:,1) + x(:,2) + x(:,3) + x(:,4) + x(:,5)).*k.*w;
%
% [X1, X2, X3, X4, X5] = ndgrid(0:.1:2); % Should I give this condition in a nested loop?
%
% X = [X1(:), X2(:), X3(:), X4(:), X5(:)];
%
% P = fun(X);
% [bestP, idx] = min(P(:))
% best_X = X(idx,:)

채택된 답변

Alan Weiss
Alan Weiss 2021년 10월 6일
Sounds like you would be best served with the Problem-Based Optimization Workflow. Declare the variables that can change as optimization variables, set the problem objective to P, and call solve.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 7
Alan Weiss
Alan Weiss 2021년 10월 7일
If you look at the objective function value
[sol,fval] = solve(prob,x0)
you find that the different solutions all have the same objective function value. So there are many solutions. Is this unexpected? This is not something that I can tell you how to fix. it is for you to determine whether the problem is formulated correctly.
Alan Weiss
MATLAB mathematical toolbox documentation

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by