Getting an equation (mostly differential) from a curve

6 Ansichten (letzte 30 Tage)
Joseluis Colunga
Joseluis Colunga am 3 Apr. 2017
Kommentiert: John D'Errico am 3 Apr. 2017
Hello there! I'm here with another question.
Sometimes, I am asked to graph certain points on the curves shown in the picture below:
The thing is, my boss knows this is tedious and that's why he orders me to do this. I'm a lazy person and dislike to locate the y's using the x's on the graph, and I do this pretty often. So, I needed the equation that created the graph.
Anyway, my question is: How can I create an equation (pretty sure it's a differential one) to fit these curves? Is it possible to create equations from a curve that already exists? (like reverse engineering)
How can I change a parameter to create a 0%, 10%, 20%, 50%, 75%, 100% and so on? I already made my research reading a book about glass colorants, but the model does not fit at all.

Antworten (1)

John D'Errico
John D'Errico am 3 Apr. 2017
This is what interpolation does. Use a list of (x,y) pairs to allow you to predict a value on the curve that is intermediate to the original data.
I'd start with interp1. It has various methods you can choose. 'pchip' will probably be a good choice for your data.
  2 Kommentare
Joseluis Colunga
Joseluis Colunga am 3 Apr. 2017
That's what i'm doing right now. Just setting y coordinates whenever the curve changes concavity or has a crucial slope change.
John D'Errico
John D'Errico am 3 Apr. 2017
I have now a bit more time to answer some of your questions.
The nice thing about pchip as an interpolation method, is it is pretty good at dealing with harder problems, like where a curve transitions into a constant, etc. More traditional splines will fail at that.
You ask about coming up with an equation for a curve. Thatis generally quite difficult, to come up with some equation that fits any general curve. People ask for it all the time, but an interpolant is by far your best bet. If you have some intelligently chosen physical model that is appropriate for the data, then great. But here I sincerely doubt that is the case.
Next, it sounds like you want to interpolate between curves too. That part is easy, if I understand what you are asking.
Suppose you have two curves, one at 20%, another at 50%, but you want to see a value interpolated as if you also had a curve at 37%. Of course you don't, but interpolation is easy.
Get two predictions for a given value of x. Here, I'll call them Ypred1 and Ypred2. Again, just call interp1 twice to do that.
P1 = 20;
P2 = 50;
Pgoal = 37;
Ypred = Ypred1*(P2-Pgoal)/(P2-P1) + Ypred2*(Pgoal-P1)/(P2-P1);
This will give you an interpolated value between curves.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by