필터 지우기
필터 지우기

Linearize an exponential curve for feeding it in GAMS

조회 수: 4 (최근 30일)
panagiotis skrempos
panagiotis skrempos 2023년 1월 18일
댓글: panagiotis skrempos 2023년 1월 18일
I have a set of data that creates an exponential curve. I want to linearize it in order to load it into a gams model.
Any ideas on how I can achieve it?
Thank you for your time!

답변 (1개)

John D'Errico
John D'Errico 2023년 1월 18일
편집: John D'Errico 2023년 1월 18일
What do you mean by linearizing a nonlinear curve? I can think of many ways to do that. But no matter what, a nonlinear function is not linear.
For example, one thing you MIGHT be looking to do is to log it. So if your data is
x = -5:5;
y = 2*exp(x/3) + 1;
plot(x,y,'o')
Then we might decide to just take log(y). Of course, that would fail sometimes, because logs of negative numbers will be complex.
plot(x,log(y),'o')
Is that linearized? Not really, because the log of the sum of terms is nothing special.
Or, are you hoping to approximate the relationship using a linear approximation? For example, a truncated Taylor series? Since all you have is the data, that is not really an option. But nothing stops you from using polyfit.
P1 = polyfit(x,y,1)
P1 = 1×2
0.9136 4.3091
So the linear approximation model is just
syms x
vpa(P1(1)*x + P1(2))
ans = 
But while there are many things you MIGHT be thinking about to linearize this model, until you explain more clearly what you mean by the word "linearize" it is impossible to help you more.
You might even post your data, if you want better help yet.
  댓글 수: 1
panagiotis skrempos
panagiotis skrempos 2023년 1월 18일
First of all, thank you for your quick response. I want to do something similar to the thing in the picture, in which the red is the curve and the black the linearization. I get the polyfit method, however this one with the log, it makes linear the logy and not y.

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

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by