Can I optimize (using optimization tool box) few variables for a quantity extracted from a covariance matrix (Lyap function) numerically?
I know a bit about using optimization tool box for a symbolic function. But I want to use it for numercal values, if possible. For example, the stucture of my code is following:
fid = fopen(sprintf( ‘test.dat’),’w’ )
for a=0:1:10
for b=0:1:10
x=[];
x0=[];
for c=0:1:10%optimizing this one
A=[….];matrix
B=[…..]; %matrix
V=Lyap(A,B);
v1=(V(1,1)+V(2,2)-1)/2;%somthing from V
.
.
v4=….
x0=[x0; c, v1, v2, v3…]% storing
end %loop c
if size(x0~0)
x=[x0;x];
m1=x(:,4);
[p, q]=max(a); %finding max
c0=x(q,1);%correspoding value of c for that max
v10=x(q,2);correspoding value of v1 for that max
.
.
fprintf(fid,’%f %f %f %f’…., a, b, c0, v01….. )%writing to a file
end %loop if
end %loop b
end %loop a
fclose(fid); %close file
Now I want to use optimization tool as follow, if possible
function [ v1, v2, v3…..vn ]=myfn[a, b, c, V]
v1=(V(1,1)+V(2,2)-1)/2;
v2=….
v3=….
v4=….
end
then calling this function for optimization in main code.
Which optimization tool shall I use for such a numerical optimization?
Thanks a lot.I know a bit about using optimization tool box for a symbolic function. But I want to use it for numercal values, if possible. For example, the stucture of my code is following:
fid = fopen(sprintf( ‘test.dat’),’w’ )
for a=0:1:10
for b=0:1:10
x=[];
x0=[];
for c=0:1:10%optimizing this one
A=[….];matrix
B=[…..]; %matrix
V=Lyap(A,B);
v1=(V(1,1)+V(2,2)-1)/2;%somthing from V
.
.
v4=….
x0=[x0; c, v1, v2, v3…]% storing
end %loop c
if size(x0~0)
x=[x0;x];
m1=x(:,4);
[p, q]=max(a); %finding max
c0=x(q,1);%correspoding value of c for that max
v10=x(q,2);correspoding value of v1 for that max
.
.
fprintf(fid,’%f %f %f %f’…., a, b, c0, v01….. )%writing to a file
end %loop if
end %loop b
end %loop a
fclose(fid); %close file
Now I want to use optimization tool as follow, if possible
function [ v1, v2, v3…..vn ]=myfn[a, b, c, V]
v1=(V(1,1)+V(2,2)-1)/2;
v2=….
v3=….
v4=….
end
then calling this function for optimization in main code.
Which optimization tool shall I use for such a numerical optimization?
Thanks a lot. I know a bit about using optimization tool box for a symbolic function. But I want to use it for numercal values, if possible. For example, the stucture of my code is following:
fid = fopen(sprintf( ‘test.dat’),’w’ )
for a=0:1:10
for b=0:1:10
x=[];
x0=[];
for c=0:1:10%optimizing this one
A=[….];matrix
B=[…..]; %matrix
V=Lyap(A,B);
v1=(V(1,1)+V(2,2)-1)/2;%somthing from V
.
.
v4=….
x0=[x0; c, v1, v2, v3…]% storing
end %loop c
if size(x0~0)
x=[x0;x];
m1=x(:,4);
[p, q]=max(a); %finding max
c0=x(q,1);%correspoding value of c for that max
v10=x(q,2);correspoding value of v1 for that max
.
.
fprintf(fid,’%f %f %f %f’…., a, b, c0, v01….. )%writing to a file
end %loop if
end %loop b
end %loop a
fclose(fid); %close file
Now I want to use optimization tool as follow, if possible
function [ v1, v2, v3…..vn ]=myfn[a, b, c, V]
v1=(V(1,1)+V(2,2)-1)/2;
v2=….
v3=….
v4=….
end
then calling this function for optimization in main code.
Which optimization tool shall I use for such a numerical optimization?
Thanks a lot. optimization, lyap, linear equations, functions MATLAB Answers — New Questions