excell logarithmic trend formula equivalent in matlab

Hi everyone I would like to ask if anyone knows if there is matlab equivalent of excell logarithmic trend fitting function in matlab, which will also show trend formula like this y=a+b*ln(x)

답변 (1개)

Matt Fig
Matt Fig 2012년 10월 1일
x = 1:.1:10;
y = 3 + 4.5 * log(x);
polyfit(log(x),(y),1)

댓글 수: 3

Thank you for answer,but I wonted a different thing. The point is that the in excell the coeficients a and b are estimated that is they are unknown. The values of x and y are known and I need to fit a logarithmic trendto them and also the trend formula to be estimated in matlab.
Ummm, I am not certain that you looked at what I posted... Did you see what polyfit returned above? If it worked on your machine like it does on mine then it returned the same coefficients I used in calculating y.
So to recap. I did not tell polyfit what a and b are, I simply passed it some data and it figured out what a and b are as a function of the data. Sounds like what you describe above... Now if you want to make a function out of the return from polyfit (for plotting or whatever), look at the help for POLYVAL and read up on function handles.
Thaнks I just got in what You said, it seems to be what I needed.

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2012년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by