Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how use from fitting for log function?

Subject: how use from fitting for log function?

From: ghasem

Date: 15 May, 2013 21:59:10

Message: 1 of 2

Hi.
I had a nonlinear equation.so I solved it and I obtained set of points and plot them.for example (x,y) pairs are my results and plot(x,y) give me my diagram.
now,I want to use from fitting to obtain a relation between x,y.
I know general form of this relation is as following:
y = c1*log(x)+c2
how I can use from fitting to obtain c1 and c2 constants?
I saw in plot window of MATLAB there is not log function.and there is only polynomial functions for fitting.
how use from fitting in my problem?
thanks

Subject: how use from fitting for log function?

From: Tom Lane

Date: 16 May, 2013 13:42:45

Message: 2 of 2

> y = c1*log(x)+c2
> how I can use from fitting to obtain c1 and c2 constants?

This is linear as a function of log(x), so just use log(x) when fitting or
evaluating it. For example:

load census
b = polyfit(log(pop),cdate,1)
plot(pop,cdate,'x')
line(pop,polyval(b,log(pop)),'color','r')


-- Tom

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us