How can I make logaritmic fitting like polyfit function

조회 수: 23 (최근 30일)
Dogan Arik
Dogan Arik 2018년 10월 19일
댓글: Dogan Arik 2018년 10월 22일
Hi;
I want to make logaritmic fitting but I don't find any logfit function like polyfit. Is there any function,script etc. that make logaritmic curve fitting in matlab
-edit- (19.10.2018 - 15:20)
I want to this type of curve fitting.
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 10월 19일
Could you give an example of what a multi-term model might look like?

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

채택된 답변

Torsten
Torsten 2018년 10월 19일
Fit log(x) against y using a linear polynomial in "polyfit". What's the problem ?
  댓글 수: 6
Torsten
Torsten 2018년 10월 22일
편집: Torsten 2018년 10월 22일
x are your input data, y are your output data in both suggestions.
If you have matrices of input and output data, make them to vectors by using
x = x(:);
y = y(:);
Best wishes
Torsten.
Dogan Arik
Dogan Arik 2018년 10월 22일
I have not problem with convert matrices to vectors.
fun = @(p,x) p(2)*exp(p(1)*x);
p0 = [1, 1];
p = lsqcurvefit(fun,p0,x,y)
yfit = fun(p,x);
plot(x,y,x,yfit)
I change my code according second code you suggest, then it solves my problem .
Thanks for all thing;

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by