MATLAB Answers

Multi-stage amplifier optimization

126 views (last 30 days)
Margetik
Margetik on 8 Jan 2021
Answered: Alan Weiss on 8 Jan 2021
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;

  0 Comments

Sign in to comment.

Answers (1)

Alan Weiss
Alan Weiss on 8 Jan 2021
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

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!