Two-terms Exponential model

조회 수: 3 (최근 30일)
Emiru
Emiru 2016년 1월 30일
편집: Emiru 2017년 1월 24일
I need to use the polyfit command to determine the best exponential coefficients for the following two-terms equation:
y= a1 * exp(b1*x1^2+b2*x2^2+b3*x1*x2+b4*x1+b5*x2)
For the simplest situation (y= a* exp(kx)) I would proceed like this:
yeqn = @(coefs, x) coefs(1).*exp(coefs(2).*x);
xi = x;
eta = log(y);
P = polyfit(xi, eta, 1);
MyCoefs(1) = exp(P(2));
MyCoefs(2) = P(1)
is there any chance to do the same thing for my situation or should I use another approach?
  댓글 수: 1
Rena Berman
Rena Berman 2017년 1월 24일
(Answers dev) Restored question.

댓글을 달려면 로그인하십시오.

채택된 답변

John BG
John BG 2016년 1월 30일
you really need to define the window where you want to approximate the exponential function with a polynomial otherwise the same polynomial matching your exponential within a window fall behind throughout another because is left behind by the 'faster' growing capacity that exponentials have against polynomials, of any kind.
Having made clear the windowing point, instead of saying
.. need to use the polyfit command to determine the best exponential coefficients for the following 2nd order two-terms equation ..
try saying
.. need to use the polyfit ..to determine the best polynomial coefficients for the follwing equation ..
if it's the case you want to approximate an exponential with a polynomial, that is not made clear either, or the other way around.
So, please define first the function you want to approximate, and the kind of function you want to use to approximate the previous function.
And usually, the term 'second order' or generic 'n-th order' is usually applied to polynomials, not exponentials.
the polynomial order is precisely the last field of the polyfit( , , order) function. If as in your suggested script used order=1 it's like saying you want to approximate a reasonably complex function, your exponential, with either a constant or a straight line, and then there is no need for polyfit, just get the average within the window of interest, or the values of the functions on both tips of the window, and there you already have the line you are after.
John

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by