CE20230 Lecture Notes - Lecture 6: Power Law, Environmental Engineering

14 views3 pages
4 Sep 2016
School
Course
Professor
UNIVERSITY OF NOTRE DAME
Department of Civil and Environmental Engineering
and Earth Sciences
CE 20230 Engineering Programming
A.S. Donahue
Non–Linear Curve Fitting Info
This brief worksheet goes over the details of how we determine the non linear model using the
results of our linear fitting in Matlab. Recall that if we wish to fit a non–linear model to a set of
data our strategy is to fit a linear model to the data after it has been altered in some way, in brief
this looks like:
1. If we wish to fit a Power Law model y=bxmwe fit the following
>> r = polyfit(log(x),log(y),1)
>> y = exp(r(2))*x.^r(1)
we note that the data should look fairly linear on a log–log plot, i.e.
>> loglog(x,y)
2. If we wish to fit an Exponential model y=bemx we fit the following
>> r = polyfit(x,log(y),1)
>> y = exp(r(2))*exp(r(1)*x)
we note that the data should look fairly linear on a semilog–y plot, i.e.
>> semilogy(x,y)
3. If we wish to fit a Logarithmic model y=mln(x) + bwe fit the following
>> r = polyfit(log(x),y,1)
>> y = r(1)*log(x)+r(2)
we note that the data should look fairly linear on a semilog–x plot, i.e.
>> semilogx(x,y)
4. If we wish to fit a Reciprocal model y=1
mx +bwe fit the following
>> r = polyfit(x,1./y,1)
>> y = 1./(r(1)*x+r(2))
we note that the data should look fairly linear on a reciprocal rectilinear plot, i.e.
>> plot(x,1./y)
Note that for plotting we don’t alter the data, we just use a different plot command. Its only
when using polyfit that we alter the data.
1
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Notes+

Unlimited access to class notes and textbook notes.

YearlyBest Value
75% OFF
$8 USD/m
Monthly
$30 USD/m
You will be charged $96 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.