L1 Norm for a linear system
27 views (last 30 days)
Show older comments
Hi All,
I am trying to write an m-file for a function that returns L1 norm for a linear system using linprog (linear programming). I wrote the code below but it’s not working. I don’t know how to declare x as an unknown vector variable. The 2nd line gives me an error message which states “Not enough input arguments.”
Any help is highly appreciated and thanks in advance. EK
function n = lpaxb(Aeq,beq
n = norm((Aeq*x-beq),1)
x = linprog('lpaxb.m', n, A, b, Aeq,beq)
End
0 Comments
Answers (1)
Walter Roberson
on 31 Jan 2012
I see no evidence in the current documentation that linprog can be invoked with a string as its first argument.
If the string is intended to represent a "solver", then you need to pass in a problem structure, which is a structure with fields listed in the documentation under "Input Arguments". Note that if the string is a solver, it should be a function name, not the name of a .m file. With the lack of information about the "solver" field, it could be that "solver" needs to be literally 'linprog' .
I see no input field that I can match to your "n". If your "n" is intended to be a parameter to your chosen solver, then I cannot tell from the documentation whether there is a way to pass it in explicitly.
2 Comments
Walter Roberson
on 31 Jan 2012
You cannot use linprog() to minimize functions such as lpaxb. The first argument you pass to linprog() must be a vector or matrix. The parameter will be matrix-multiplied by the current vector of values ("x") and linprog() will be attempting to find the "x" vector that makes the output result zeros.
I do not know if there are useful alternatives designed for linear programming. You might have to use a minimizer such as fmincon().
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!