Azzera filtri
Azzera filtri

Polynomial surface fitting problem with constraint y <=1

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

John D'Errico
John D'Errico il 20 Mar 2022
Modificato: John D'Errico il 20 Mar 2022
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 Commenti
John D'Errico
John D'Errico il 21 Mar 2022
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.
Wenlin
Wenlin il 21 Mar 2022
Yeah that makes sense, thank you for guiding me through it!

Accedi per commentare.

Più risposte (1)

Torsten
Torsten il 20 Mar 2022
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".

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by