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!