Multi-stage amplifier optimization

조회 수: 2 (최근 30일)
Margetik
Margetik 2021년 1월 8일
답변: Alan Weiss 2021년 1월 8일
I have written the following code in order to optimize a 5 stage amplifier, using the fmincon solver, which is contained in the MATLAB Optimization tool, I am also testing the various solution algorithms offered (Interior point, SQP, Active set, Trust region reflective)
There is a problem with my code, my guesses are it is in the second part. If anyone has any idea i would be grateful.
%myfun.m
function D = myfun(A)
%First Part
N0 = 0;
N1 = A(1)*sqrt(N0^2 + 10^-10);
N2 = A(2)*sqrt(N1^2 + 10^-6);
N3 = A(3)*sqrt(N2^2 + 10^-4);
N4 = A(4)*sqrt(N3^2 + 10^-4);
N5 = A(5)*sqrt(N4^2 + 10^-2);
N5 = Nout;
%Second Part
Sin1 = 0.1/A(1);
Sin2 = 3/A(1)*A(2);
Sin3 = 5/A(1)*A(2)*A(3);
Sin4 = 8/A(1)*A(2)*A(3)*A(4));
Sin5 = 12/A(1)*A(2)*A(3)*A(4)*A(5);
smin = min(Sin1,Sin2,Sin3,Sin4,Sin5);
smin = Smax;
D = Smax/Nout;
%mycon.m
function [c,ceq] = mycon(A)
c = [];
ceq (1) = A(1)*A(2)*A(3)*A(4)*A(5) = 10000;

답변 (1개)

Alan Weiss
Alan Weiss 2021년 1월 8일
I didn't try too run your code, but this line is incorrect syntax:
ceq (1) = A(1)*A(2)*A(3)*A(4)*A(5) = 10000;
It should be
ceq = A(1)*A(2)*A(3)*A(4)*A(5) - 10000;
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by