Find vector that minimize the matrix equation

7 views (last 30 days)
Hi, I want to find vector x of x=[x1,x2,x3,x4,x5] to minimize the value of norm(Ax-b), A is (100,5) matrix and b is (100,1) vector are given. How can I get a vector x that minimize 'norm(Ax-b)+lambda*(sum(abs(x)>0)'? 'lambda' is given constant. I tried 'fminsearch', but it only works for get scalar value.

Answers (1)

Torsten
Torsten on 9 Jul 2022
x = A\b
is a vector that minimizes norm(A*x-b).
  2 Comments
John D'Errico
John D'Errico on 9 Jul 2022
Lol. Nope. But close. I wanted to respond the same way at first. Then I noticed that if b is a 5x1 vector, and A is 100x5, then A*x is a 100x1 vector, and it will not be possible to form A*x-b, and therefore the norm is meaningless.
So there is a mistake in the question in some way.
Possibly A is a 5x5 matrix, in which case then norm is a waste of time since the solution is unique.
Or b should have been a 100x1 vector.
Or, something else that I cannot imagine. Perhaps @Jihun Gil does not recognize the problem is meaningless when A is 100x5, x is 5x1n, and b is 5x1.
Jihun Gil
Jihun Gil on 10 Jul 2022
Oh sorry. I miswrite the size of vector b. b is (100,1) vector.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!