Polynomial surface fitting problem with constraint y <=1
3 ビュー (過去 30 日間)
I'm trying to fit an emperical relationship between dependent variable y and two independent variables x1 & x2.
I tried to formulate it as an equation of form y = a*x1^b + c * x2^d where a, b, c, d are constants to be found. This is simple to do with lsqcurvefit. However, I also need to add a constraint that y <= 1, which is a property of the system. I tried looking into the Optimization Toolbox but can't seem to find a suitable solver.
Would really appreciate if someone could suggest either a way to solve this equation or a better way to formulate the relationship.
Below is the data points I have. I don't really know much about the relationship between y (capacity) and the two independent variables other than it decreases as the cumulative Ah discharged increases and is the highest at 25 degC.
John D'Errico 2022 年 3 月 20 日
編集済み: John D'Errico 2022 年 3 月 20 日
You have the model:
y = a*x1^b + c*x2^d
I'll assume that x1 is temperature, and x2 is current discharged.
You have told us it must be monotone decreasing with increasing discharge (x2). That just tells us that c*d must be negative, since the first derivative of that expression with respect to x2 is just
dy/dx2 = c*d*x2^(d-1)
With x2 positive, if that expression is negative, then c*d < 0 must apply.
But then you tell us the expression attains its maximum at T = x1 = 25. 25 is right in the middle of your test data. Can that expression have a maximum at some middle point in the domain? Again, form a partial derivative, this time with respect to x1.
dy/dx1 = a*b*x1^(b-1)
If it is maximal there, then you would have that expression == 0. And that means either x1=T=0, a=0, or b=0. Which is it? Any of those cases tells me your model makes no sense in terms of what you have told us.
I can stop right here, since your other constraint that the maximum must be 1 is irrelevant, IF the model makes no sense in context of what you have already told us. It would be easy to apply that constraint for this model, but still, why bother when the model is clearly not descriptive of what you have? Anyway, if the function must be maximal at T=x2=0, then all you need to do is constrain the value at the point T=0, C=25. But again, it is not relevant, since your function cannot encapsulate the curve shape you think must exist.
その他の回答 (1 件)
Torsten 2022 年 3 月 20 日
If N is the number of (y12,x1,x2) data, use fmincon instead of lsqcurvefit and set the constraints
a*x1_i^b + c*x2_i^d - 1 <= 0 (i=1,2,...,N)
in the function "nonlcon".
Find more on Solver Outputs and Iterative Display 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!