Least Squares with constraint on absolute value
4 ビュー (過去 30 日間)
古いコメントを表示
Hi , I need to solve a least squares values of the form
, where x is a 32x1 vector and B is a 32x32 matrix.
Howerver, x is complex and I need to constraint the solutions to make each element of vector x to have absolute value of 1.
Is that possible?
Best,
0 件のコメント
採用された回答
Torsten
2023 年 6 月 16 日
編集済み: Torsten
2023 年 6 月 16 日
rng("default")
n = 32;
y = rand(n,1) + 1i*rand(n,1);
B = rand(n) + 1i*rand(n);
x0 = rand(n,1) + 1i*rand(n,1);
x0 = [real(x0);imag(x0)];
x0 = x0./[sqrt(x0(1:n).^2+x0(n+1:2*n).^2);sqrt(x0(1:n).^2+x0(n+1:2*n).^2)];
fun = @(x)(B*(x(1:n)+1i*x(n+1:2*n))-y)'*(B*(x(1:n)+1i*x(n+1:2*n))-y);
fun(x0)
nonlcon = @(x)deal([],x(1:n).^2+x(n+1:2*n).^2-ones(n,1));
sol = fmincon(fun,x0,[],[],[],[],[],[],nonlcon,optimset('MaxFunEvals',10000,'TolFun',1e-12,'TolX',1e-12))
fun(sol)
sol(1:n).^2+sol(n+1:2*n).^2-ones(n,1)
その他の回答 (1 件)
Matt J
2023 年 6 月 15 日
編集済み: Matt J
2023 年 6 月 15 日
You'll need to write the problem in terms of the real-valued components xi and xr of x,
x=xr+1i*xi
Once you do that, your absolute value constraints become quadratic,
xr^2+xi^2=1
and you can solve with fmincon.
2 件のコメント
Matt J
2023 年 6 月 16 日
I meant that you should follow the example here,
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!