lagrange multipliers - curve fitting toolbox
2 views (last 30 days)
Show older comments
Hi
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
0 Comments
Accepted Answer
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?
7 Comments
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)
end
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
on 7 Jul 2013
Edited: Matt J
on 7 Jul 2013
@Andrew
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
cost(x,y)<=C
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
gradient(emissions)=L*gradient(cost)
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).
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!