Minimization of a function

조회 수: 1 (최근 30일)
Sultan
Sultan 2018년 12월 26일
편집: Sultan 2019년 1월 15일
I have only two matrices A=[1,2 4; 2, 3, 4; 1, 2,3] and B=[1,2 4; 1, 2,3] in my hands. I want to solve the following problem.
where ,
such that
,
.
Please help me in providing the complete program.
Once it is computed, then I can use ''for loop'' for computing min for all rows of A and then max.
Thanks for sparing time.
  댓글 수: 4
Image Analyst
Image Analyst 2018년 12월 26일
What is allowed to change? Lambda1 and lambda2? Is there some clever method you have heard of? Of course we could do it numerically with a simple brute force iteration over all possible values of lambda1 and lambda2. Would that be good enough?
Walter Roberson
Walter Roberson 2018년 12월 26일
We are not likely to give you complete code. If you show your code and your error message then we will help you debug.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2018년 12월 26일
See lsqlin.

추가 답변 (1개)

Sultan
Sultan 2019년 1월 15일
편집: Sultan 2019년 1월 15일
Is it correct code for the above problem? In place of λ, I have used x.
A = [1 2 4; 2 3 4; 1 2 3]; B = [1 2 4; 1 2 3]
%Given: A; B;
%A = load('matrixA');
%B = load('matrixB');
n = length(B);
C = B';
D = ones(1,n);
for i = 1:length(A)
cvx_begin
variable x(n)
minimize( norm(A(i,:)' - C*x, 2))
subject to
D * x == 1
0 <= x <= 1
cvx_end
optimalValue(i) = cvx_optval^2;
X(:,i) = x;
end
maximumValue = max(optimalValue);
We can also use lsqlin. Thanks everyone for helping me.

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by