lagrange multipliers - curve fitting toolbox

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

 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?

7 Comments

Hi Matt thank you for your reply
regarding lsqcurvefit, I understand from the documentation that I require the function of the curve to use this?
I have determined the coordinates of the curve experimentally. Therefore I have two matrices with data only
Regarding the rest of my question, I have one curve for "cost" and one curve for "emissions" (and I have 10 sets of these curves. I am looking to perform a curve fit by plotting the associated Lagrange multipliers of each set of curves. I should then have 10 new coordinates that I want to plot to generate a new curve that is the optimum point of each set of curves
Thank you for your help - I hope the above is clearer!
so for lsqcurvefit what do I use for the "fun"? how can I go about not knowing the epxression of the function - is this possible?
I am looking to perform a curve fit by plotting the associated Lagrange multipliers of each set of curves.
The mathematical description of your task appears incomplete. It only makes sense to speak of a Lagrange multiplier as being "associated" with a curve, if there is an objective function that you are trying to minimize and the curve defines a constraint in the minimization problem.
thanks for your reply Matt
I understand that I should refer to the Lagrange multiplier as being associated to the curve - in my case I understand this to be the lagrange multiplier that is associated with two curves.
I am not sure how to proceed based on the data I have.
Please let me know if you have any suggestions
In a summary I have:
One curve "cost" that I have plotted from experimental data One curve "emissions" that I have plotted from experimental data
I do not have an expression/equation for this curve - however I could perform a polynomial regression to find an equation with a high R^2 value close to 1 and assume this as the equation
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
I hope the above is clearer!
Regards
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.
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.
@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).

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!