Multi-stage amplifier optimization

10 ビュー (過去 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 Center および File ExchangeSolver 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