Polynomial surface fitting problem with constraint y <=1
1 次查看(过去 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/934654/image.png)
0 个评论
采纳的回答
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.
5 个评论
John D'Errico
2022-3-21
Let me add, that this is a common way one builds such an empirical model. You start with a fundamental shape that may be appropriate for the model in one variable. Then add to it extra terms to add in the necessary behavior. Eventually you find a reasonable model for the process, one with terms that can then be estimated from the data.
更多回答(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".
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!