How to formalize an optimization problem in Matlab?
Afficher commentaires plus anciens
Hello.
How to issue a task in Matlab?
Given:
Vectors a1 and a2.
Find a vector of coefficients x such that:
abs((a2.')*x) -> min
abs ((a1.')*x) >= condition
under the conditions:
- Dimensions of vectors a1, a2 and x from 1 to p
- elements a1, a2 and x are complex numbers
- abs(a1_i)>0, abs(a2_i)>0, abs(x_i) = 1, where i =1..p
15 commentaires
Torsten
le 3 Mai 2022
So you want to maximize abs(a1.'*x). And you want to minimize abs(a2.'*x).
How do you want to combine these two objectives in one ?
reincornator
le 4 Mai 2022
Torsten
le 4 Mai 2022
Seems you get a quadratic objective with quadratic constraint. Try fmincon.
abs(x_i) = 1, where i =1..p
Are you sure it's not abs(x_i) <= 1 or sum(abs(xi).^2)=1? It would be hard to satisfy the constraint as posted.
For example, if a2=[1;0;0;0] it would be impossible to satisfy abs(a2.'*x)-->0, because abs(a2.'*x)=abs(x1) and abs(x1) is constrained to 1.
reincornator
le 4 Mai 2022
reincornator
le 4 Mai 2022
Modifié(e) : reincornator
le 5 Mai 2022
Torsten
le 4 Mai 2022
With each optimization software you use, you will have to split in real and imaginary part and thus handle two real-valued numbers simultaneously.
You are right, there is another constraint: abs(a1_i)>0, abs(a1_i)>0, i=1..p.
I assume you meant abs(a1_i)>0, abs(a2_i)>0.
That's still not enough. Consider a2=[2,1].'. Then if abs(x1)=abs(x2)=1,
abs(a2.'*x)=abs(2*x1+x2)
>=abs( 2*abs(x1) -abs(x2))
=1
So, the constraint abs(a2.'*x)=0 can never be satisfied.
reincornator
le 5 Mai 2022
Matt J
le 5 Mai 2022
My counter-example still applies. There is little guarantee that a solution will exist under those constraints.
Matt J
le 5 Mai 2022
If you had abs(a2_i)=1 for all i=1...p. You might be able to guarantee existence of a solution for p>1.
reincornator
le 5 Mai 2022
How to write such a condition for vector x in constraints?
Your problem wouldn't be written in terms of x_i in what Torsten is recommending. Your objective and constraints would be written in terms of independent variables (u_i, v_i) where u_i stands in for the real component of x_i and v_i stands in for the imaginary component. The constraint, written differentiably, would be,
u_i^2 + v_i^2 = 1
reincornator
le 5 Mai 2022
Matt J
le 5 Mai 2022
c and ceq can be vectors.
Réponses (1)
N=null(a2.');
a3=a1.'*N;
[~,idx]=max(abs(a3));
x=N(:,idx);
6 commentaires
randcomplex = @(x,y) rand(x,y).*exp(2i*pi*rand(x,y));
a1 = randcomplex(10,1);
a2 = randcomplex(10,1);
N=null(a2.');
a3=a1.'*N;
[maxval,idx]=max(abs(a3));
x=N(:,idx)*conj(a3(idx))/abs(a3(idx))
a2.'*x
maxval,
abs(a1.'*x)
reincornator
le 5 Mai 2022
Modifié(e) : reincornator
le 5 Mai 2022
Matt J
le 5 Mai 2022
The graph shows that such a solution does not satisfy the condition abs(x_i)=1
Yes, because as I've said above, I don't think you will be able to find such a solution.
reincornator
le 5 Mai 2022
Torsten
le 5 Mai 2022
I thought a2'*x should be 0...
Catégories
En savoir plus sur Choose a Solver dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

