Imposing additional constraints while using 'lsqnonneg'

Hi everyone,
I would like to impose additional constraints while using 'lsqnonneg'. Besides the non-negativity of the solution, I want to constrain the solution to be zero at the end points. I appreciate your effort towards the community.
thanks sathish.

回答 (1 件)

Teja Muppirala
Teja Muppirala 2012 年 7 月 10 日

1 投票

I think this should work.
If you are minimizing |Cx - d|
First, remove the first and last columns of C, and call LSQNONNEG on that:
X = lsqnonneg(C(:,[2:end-1]),d)
Then add a zero to the beginning and end:
X = [0; X ; 0]

1 件のコメント

Sathish Akella
Sathish Akella 2012 年 7 月 10 日
Hi Teja,
Thanks for the suggestion. I have two questions related to your answer.
1. Would the solution be same as if we solve for the whole matrix 'C' and setting the end points of 'X' to zero? And also, is it not artificial to just set the end points to zero?
2. I feel that, the solution would not be smoothly going to zero at the end points. Does it make sense to you or I am just being stupid? I want only those solutions which are smoothly going to zero at the end points.
The way I wanted to do is to solve for 'X' by repeatedly feeding the guess 'X0' with end points set to zero. For example,
for i = 1:maxIter
problem = struct('C', C, 'D', D, 'X0', X0, ...
'solver', 'lsqnonneg', ...
'options', optimset('Display', 'notify', 'TolX', 1e-8));
[X, resnorm, residue, exitflag] = lsqnonneg(problem);
X0 = X;
X0(1) = 0; X0(end) = 0;
end
What I am not sure is that, if this also yields the same solution as yours.
thanks sathish.

サインインしてコメントする。

カテゴリ

質問済み:

2012 年 7 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by