Borrar filtros
Borrar filtros

How do I optimize my code with respect to 4 variables (x_1 x_3 k1 k2 k3)?

1 visualización (últimos 30 días)
Alex M
Alex M el 21 de Nov. de 2017
Comentada: Walter Roberson el 21 de Nov. de 2017
%%Parameters
format short
% Constants
rho=1.225;
U=170;
s=1;
c=0.5;
c_2=1;
b=0.5*c;
m=5;
I_CG=0.05;
m_p=0.5;
% x_p=(0:0.01:c);
zero=[0 0; 0 0];
% Variables
x_g=0.5*c;
x_ac=0.25*c;
x_1=0.1*c;
x_3=0.7*c;
q=0.5*rho*u^2;
c_2=1;
%x_1 x_3 k1 k2 k3 have to changed in order to result in the highest u;
%k1+ k2+ k3 <30000
for u = [0:1:75]
M=[ m -m*(x_ac - x_g); -m*(x_ac - x_g) I_CG + m*(x_ac - x_g)^2 ];
E=[k1 + k2 + k3 k1*(x_1 - x_ac) + k3*(x_3 - x_ac); k1*(x_1 - x_ac) + k3*(x_3 - x_ac) k1*(x_1 - x_ac)^2 + k3*(x_3 - x_ac)^2];
B=[1+c_2/(pi*s*c*rho) c/2; 0 c^2/16];
Bbar=pi*s*c*rho*[B];
K=[0 1; 0 0];
Kbar=pi*s*c*rho*[K];
A=[[M] u*[Bbar];[zero] [M]];
C=[[zero] [E]+u^2*[Kbar] ; -[M] [zero] ];
c_2;
u;
lambda=eig(C,-A);
if any(lambda>0)
break
end
u
  4 comentarios
Alex M
Alex M el 21 de Nov. de 2017
u velocities are being tested, and the best combination of the x_1 x_3 k1 k2 k3 will give me the greatest u velocity before the code reads a positive value in the eigenvector.
Walter Roberson
Walter Roberson el 21 de Nov. de 2017
Okay.
I do not observe anything that indicates how those five variables are to be changed as you go?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by