現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How to formalize an optimization problem in Matlab?
1 回表示 (過去 30 日間)
古いコメントを表示
reincornator
2022 年 5 月 3 日
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 件のコメント
Torsten
2022 年 5 月 3 日
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
2022 年 5 月 4 日
It is necessary to find a vector x such that:
abs ((a1.')*x) -> max - goal
abs((a2.')*x) < tol, wheh tol->0 - limitations
Matt J
2022 年 5 月 4 日
編集済み: Matt J
2022 年 5 月 4 日
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
2022 年 5 月 4 日
Torsten, thanks. The "fmincon" function only works with real numbers. I use complex numbers.
reincornator
2022 年 5 月 4 日
編集済み: reincornator
2022 年 5 月 5 日
Matt J, thanks. You are right, there is another constraint: abs(a1_i)>0, abs(a2_i)>0, i=1..p.
Torsten
2022 年 5 月 4 日
With each optimization software you use, you will have to split in real and imaginary part and thus handle two real-valued numbers simultaneously.
Matt J
2022 年 5 月 4 日
編集済み: Matt J
2022 年 5 月 4 日
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
2022 年 5 月 5 日
@Matt J, thank you. Corrected the condition.
abs((a2^T)*x) < tol, tol-> 0
Matt J
2022 年 5 月 5 日
My counter-example still applies. There is little guarantee that a solution will exist under those constraints.
Matt J
2022 年 5 月 5 日
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
2022 年 5 月 5 日
@Torsten, in real numbers, the condition abs(x_i)=1, can be written as Re(x_i)=sqrt(1-Im(x_i)^2). How to write such a condition for vector x in constraints?
Matt J
2022 年 5 月 5 日
編集済み: Matt J
2022 年 5 月 5 日
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
2022 年 5 月 5 日
回答 (1 件)
Matt J
2022 年 5 月 4 日
編集済み: Matt J
2022 年 5 月 4 日
N=null(a2.');
a3=a1.'*N;
[~,idx]=max(abs(a3));
x=N(:,idx);
6 件のコメント
Matt J
2022 年 5 月 4 日
編集済み: Matt J
2022 年 5 月 4 日
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))
x =
0.1546 - 0.3938i
0.0998 + 0.0391i
0.0617 - 0.0385i
0.0246 + 0.1474i
0.1035 + 0.0910i
0.0625 + 0.0216i
-0.5747 - 0.6314i
0.0177 + 0.0661i
0.0371 - 0.0283i
0.0319 + 0.1476i
a2.'*x
ans = -8.3267e-17 + 5.5511e-17i
maxval,
maxval = 0.7671
abs(a1.'*x)
ans = 0.7671
reincornator
2022 年 5 月 5 日
編集済み: reincornator
2022 年 5 月 5 日
@Matt J, thank you. The graph shows that such a solution does not satisfy the condition abs(x_i)=1
randcomplex = @(x,y) rand(x,y).*exp(2i*pi*rand(x,y));
a1 = randcomplex(40,1);
a2 = randcomplex(40,1);
N=null(a2.');
a3=a1.'*N;
[maxval,idx]=max(abs(a3));
x=N(:,idx)*conj(a3(idx))/abs(a3(idx));
a2.'*x;
[a1.';a2.']*x
ans =
0.9866 + 0.0000i
0.0000 - 0.0000i
plot(abs(x))
Matt J
2022 年 5 月 5 日
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
2022 年 5 月 5 日
@Matt J, I found one solution. It is implemented using a special algorithm and shows a good result. But I'm looking for a better way.
参考
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)