MATLAB Answers

lagrange multipliers - curve fitting toolbox

12 views (last 30 days)
I have two curve sets - "A" and "B". Both are a 10x6 matrix that output a contour plot with 10 lines each. I am looking for the lagrange multiplier of each "cost" and "emissions" curve.
Since I already have the coordinates - does anyone know how I can find the lagrange multipliers of each point and effectively plot a third curve?
Thank you


Sign in to comment.

Accepted Answer

Matt J
Matt J on 6 Jul 2013
Edited: Matt J on 6 Jul 2013
I understand that this can be done using the "curve fitting toolbox" which I dont have on my system.
That doesn't sound right. You might be thinking of LSQCURVEFIT in the Optimization Toolbox,
which does return Lagrange Multipliers, lambda, as an optional output argument. So, if you don't have the Curve Fitting Toolbox, but you do have the Optimization Toolbox, your problem could already be solved!
The rest of your question, I cannot understand, I'm afraid, in particular what your "third curve" refers to. You mean you want to fit a different curve to each isocontour and plot the associated Lagrange multipliers as a function of the isovalue?


Show 4 older comments
Marc on 6 Jul 2013
Ok, but your cost and emissions have to have the same x values.
Meaning, for x(1) there is a function f(x) and g(x) or you can rethink this in Matlab as
function f = yourFun(x)
f = zeros(2,1);
f(1) = some expression for cost
f(2) = some expression for emissions
Now lscurvefit can take your x's and minimize your function. You will have to reconfigure your function something like is...
function f = yourFitFunc(a, xdata)
Where the a can be a vector of the parameters your fitting, a(1), a(2), a(3)..... If you have no idea how these expressions should look or whether they rely on each other, than finding lambda, may not be what you are looking for.
Marc on 7 Jul 2013
OK, lets start with an example from my past.
I set up a DOE to study the effect of precious metals loading on catalytic converters. 3 levels for each precious metal (Pd, Pt, Rh).
I have some expression for cost as a function of precious metal loading (ie. weight percent times the cost of each precious metal). This is my cost function.
Each converter also give me a engine out result for NOx, CO and CH4 (ie emissions). I am able to obtain a "emissions" function for this.
So, I then want to "optimize" my precious metals loading by minimizing the cost and minimizing the engine out data.
There were a couple ways to try this but one way was doing something like this....
function g = myFunc(pgm)
f(1) = cost function;
f(2) = a1*pgm(1) + a2*pgm(2) + a3*pgm(3) + a4*pgm(1)*pgm(2) + ... a5*pgm(2)*pgm(3) + a6*pgm(1)*pgm(3) + a7*pgm(1)*pgm(2)*pgm(3);
f(3) = b1*pgm(1) + b2*pgm(2) + b3*pgm(3) + b4*pgm(1)*pgm(2) + ... b5*pgm(2)*pgm(3) + b6*pgm(1)*pgm(3) + b7*pgm(1)*pgm(2)*pgm(3);
f(4) = c1*pgm(1) + c2*pgm(2) + c3*pgm(3) + c4*pgm(1)*pgm(2) + ... c5*pgm(2)*pgm(3) + c6*pgm(1)*pgm(3) + c7*pgm(1)*pgm(2)*pgm(3);
w = [1; 1; 1; 1];
g = w(1)*f(1) + w(2)*f(2) + w(3)*f(3) + w(4)*f(4)
I would then use fminsearch, fmincon, fminunc or fminbnd from the optimization tool box to optimize my PGM level for g....
Note, that I already solved for the parameters a1....a7, b1....b7, etc. etc. using backslash or regress (from stats toolbox). So what I had was multiple surfaces, so to speak in Pd, Rh and Pt levels, along with a price.
You can imagine that there is no one simple answer for this. If I set my weights (w's in my g function) all to one and I have normalized all my f's to be roughly in the same ballpark (i.e. if price is $12 per converter and NOx is measured in the 500ppm), I would want to scale these somehow in g, I would obtain one level of Pd, Rh and Pt that minimized all 4 categories but was not necessarily the best in anyone of the categories.
If cost is extremely important, I can give it a weight of 1 and all the other guys 0.5 or 0.25, and see what the pgm optimum was....
So, I never needed to use a Langragian multiplier. Also, these equations, were only valid for one set of experiments, around one formulation and for those PGM levels. No extrapolation capability with this.
Is this what you are looking for?
It sounds like this is what you are trying to do, somewhat.
Matt J
Matt J on 7 Jul 2013
The optimization problem you're trying to solve is still too impossibly unclear for us to give any meaningful advice. You will need to tell us explicitly what is being minimized/maximized, as a function of what unknowns, and what are the constraints.
I am trying to find the lagrange multiplier - as I understand it is one coordinate (x,y) that is the minimum cost and maximum emissions intercept
No, you are not using the term Lagrange Multiplier in any recognizable way here. A Lagrange multiplier is always a scalar, not a "coordinate". You cannot "multiply" something by a coordinate...
However, I get the vague impression from "minimum cost and maximum emissions intercept" that you are trying to solve a minimization problem of the form
max. emission(x,y)
subject to
where C is a variable parameter. Roughly speaking, this is a problem of finding where emission(x,y) is maximized and cost(x,y) is minimized as simultaneously as possible.
Assuming the maximization of emission() always pushes cost() to the boundary cost(x,y)=C, then the Lagrange multiplier equation for the problem is
where L>=0 is an unknown Lagrange multiplier to be determined. The Lagrange multiplier will be a function of C, so maybe it is L(C) that you want to plot???
In any case, to do anything like this, you must first have formulas for cost() and emission() as functions of something, e.g., (x,y).

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by