Symbolic Optimization

I am trying to optimize a function which gives complex values.
I used fminunc, which gave me vector of complex values though I am giving a vector of real values as the initial guess.
When I used fmincon with FunValCheck property as 'on' it gave an error that problem is in the objective function supplied by the user.
Suggest a method to optimize such a function.

Risposte (2)

Sean de Wolski
Sean de Wolski il 18 Lug 2011
Well is the function supposed to give imaginary values? If it's not perhaps you coded the function wrong - we can't help without seeing it.
Else, you could either extract just the real part of the funtion, e.g.:
f = @(x)real(fft(x));
or the absolute value
f = @(x)abs(fft(x));
etc..

3 Commenti

FedRonTev
FedRonTev il 19 Lug 2011
The function that I am trying to optimize is:::
f =
(1 - (11^(1/2)*99^(1/2))/330 + (2*R1*(a4*a5 + a6*a8 - 1 - R2*a4*a5*i + R2*i)*i)/(R2*i + R1*R2 + a1*a3 + a2*a7 + a4*a5 + a6*a8 - R1*a4*a5*i - R1*a6*a8*i - R1*R2*a4*a5 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1 - R2*a1*a3*i + R1*i - R2*a4*a5*i))^2 + ((11^(1/2)*99^(1/2))/330 - 1 + (2*R1*(a4*a5 + a6*a8 - 1 + R2*a4*a5*i - R2*i)*i)/(R1*R2 - R2*i + a1*a3 + a2*a7 + a4*a5 + a6*a8 + R1*a4*a5*i + R1*a6*a8*i - R1*R2*a4*a5 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1 + R2*a1*a3*i - R1*i + R2*a4*a5*i))^2 + (1 + (2*R1*((181*55522^(1/2)*a4*a5)/55522 - (5929741*55522^(1/2))/3082692484 + (181*55522^(1/2)*a6*a8)/55522 - R2*a4*a5*i + (32761*R2*i)/55522)*i)/((32761*R1*R2)/55522 + (5929741*55522^(1/2)*R2*i)/3082692484 + (32761*a1*a3)/55522 + (32761*a2*a7)/55522 + (32761*a4*a5)/55522 + (32761*a6*a8)/55522 - R1*R2*a4*a5 - (181*55522^(1/2)*R1*a4*a5*i)/55522 - (181*55522^(1/2)*R1*a6*a8*i)/55522 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1073283121/3082692484 - (181*55522^(1/2)*R2*a1*a3*i)/55522 + (5929741*55522^(1/2)*R1*i)/3082692484 - (181*55522^(1/2)*R2*a4*a5*i)/55522))^2 - (2*R1*((181*55522^(1/2)*a4*a5)/55522 - (5929741*55522^(1/2))/3082692484 + (181*55522^(1/2)*a6*a8)/55522 + R2*a4*a5*i - (32761*R2*i)/55522)*i)/((32761*R1*R2)/55522 - (5929741*55522^(1/2)*R2*i)/3082692484 + (32761*a1*a3)/55522 + (32761*a2*a7)/55522 + (32761*a4*a5)/55522 + (32761*a6*a8)/55522 - R1*R2*a4*a5 + (181*55522^(1/2)*R1*a4*a5*i)/55522 + (181*55522^(1/2)*R1*a6*a8*i)/55522 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1073283121/3082692484 + (181*55522^(1/2)*R2*a1*a3*i)/55522 - (5929741*55522^(1/2)*R1*i)/3082692484 + (181*55522^(1/2)*R2*a4*a5*i)/55522) - (4*R1*R2*((32761*a3)/10000 - a3*a6*a8 + a4*a6*a7 - (181*R2*a3*i)/100)^2)/((5929741*R2*i)/1000000 + (32761*R1*R2)/10000 + (32761*a1*a3)/10000 + (32761*a2*a7)/10000 + (32761*a4*a5)/10000 + (32761*a6*a8)/10000 - (181*R1*a4*a5*i)/100 - (181*R1*a6*a8*i)/100 - R1*R2*a4*a5 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1073283121/100000000 - (181*R2*a1*a3*i)/100 + (5929741*R1*i)/1000000 - (181*R2*a4*a5*i)/100)^2 + 1 - (2*(R1*R2)^(1/2)*((32761*a3)/10000 - a3*a6*a8 + a4*a6*a7 + (181*R2*a3*i)/100)*i)/((32761*R1*R2)/10000 - (5929741*R2*i)/1000000 + (32761*a1*a3)/10000 + (32761*a2*a7)/10000 + (32761*a4*a5)/10000 + (32761*a6*a8)/10000 + (181*R1*a4*a5*i)/100 + (181*R1*a6*a8*i)/100 - R1*R2*a4*a5 - a1*a3*a6*a8 + a1*a4*a6*a7 + a2*a3*a5*a8 - a2*a4*a5*a7 - 1073283121/100000000 + (181*R2*a1*a3*i)/100 - (5929741*R1*i)/1000000 + (181*R2*a4*a5*i)/100)
The input vector is
[a1 a2 a3 a4 a5 a6 a7 a8 R1 R2]
and initial guess is [.5 .5 .5 .5 .5 .5 .5 .5 1 1].
I want the output vector be scalar and optimised.
Sean de Wolski
Sean de Wolski il 19 Lug 2011
I'm not an optimization expert, but that function doesn't exactly look at all well posed/stable. I mean 10 dimensions with how many uses of each variable and no constraints? Not to mention - does having an imaginary component double the number of dimensions? (I don't know, but would assume so)
It does have an imaginary component so at least that's correct.
All I can say is good luck!
I wouldn't trust any result you get or any airplane flying with an optimization of that function.
Sean de Wolski
Sean de Wolski il 19 Lug 2011
Hmm. I guess having an imaginary component wouldn't double the number of dimensions.

Accedi per commentare.

Walter Roberson
Walter Roberson il 18 Lug 2011

0 voti

It is an error to use fminbnd() with complex variables or with a function that returns a complex value.
If I recall correctly, the only function that is usable with complex values is the Optimization Toolbox's fgaolattain() -- though perhaps one of the Global Optimization Toolbox's functions could be used.
On the other hand you asked for symbolic optimization in your title; symbolic optimization with complex values is, I believe, available in the symbolic toolbox using MuPad.

Richiesto:

il 18 Lug 2011

Community Treasure Hunt

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

Start Hunting!

Translated by