This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 14:440:127 Introduction to Computers for Engineers Notes for Lecture 06 Rutgers University, Fall 2009 Instructor- Blase E. Ur 1 Fitting To More Complicated Functions Now you know how to find the line of best fit for some data points if they are linearly related. You can use this fact, along with the idea of linearizing data, to find more complicated relationships. Linearizing means making a few substitutions for variables, which result in an equation for a line. Note that linearization has some pretty complex ramifications about what it does to your assumptions about (and ability to determine) the experimental error of your data if youre interested, see http://en.wikipedia.org/wiki/Nonlinear_regression 1.1 Figuring Out The Relationship In a number of scientific processes, y and x are exponentially or logarithmically related i.e. y=exp(x) or vice versa. However, its sometimes hard when looking at a graph to determine whether or not there is an exponential relationship, or what sort of exponential relationship exists. Matlab contains alternatives to the plot function that display exponential values for one or both axes, which is equivalent to taking the logarithm of x, y, or both x and y. 1.1.1 Semilogx Plots = Logarithmic Data In a semilogx plot, the x axis is displayed as powers of 10. Note that semilogx is used in place of plot i.e. semilogx([10 100 1000], [1 2 3]) displays that graph. The graph that is displayed is equivalent to having taken the logarithm of the x points, but left the y points the same. If your semilogx plot looks like a line, then your data may be logarithmic, of the form y = K * log ( x ) + C . Why? y = K * log ( x ) + C SUBSTITUTE: x 2 = log ( x ) y = K * x 2 + C , which is linear 1.1.2 Semilogy Plots = Exponential Data In a semilogy plot, the y axis is displayed as powers of 10. Note that semilogy is used in place of plot i.e. semilogy([1 2 3], [10 100 1000]) displays that graph. The graph that is displayed is equivalent to having taken the logarithm of the y points, but left the x points the same. If your semilogy plot looks like a line, then your data may be exponential, of the form y = C * e Kx . Why? y = C * e Kx Take the natural log of both sides of the equation: log ( y ) = log ( C * e Kx ) log ( y ) = log ( e Kx ) + log ( C ) log ( y ) = K * x + log ( C ) SUBSTITUTE: y 2 = log ( y ) AND C 2 = log ( C ) y 2 = K * x + C 2 , which is linear Solve for the coefficiencts K and C 2 ; Remember that C = e C 2 !!! Heres a semilogy plot in action: x = linspace(1,20,100); y = 5*exp(x); semilogy(x,y) 1 1.1.3 Loglog Plots = Power Function Data In a loglog plot, both the x and y axes are displayed as powers of 10. The graph that is displayed is equivalent to having taken the logarithm of both the x and y points. If your loglog plot looks like a line, then your data may be a power function, of the form y = C * x K . Why?...
View Full Document
This note was uploaded on 03/24/2011 for the course ENGINEERIN 127 taught by Professor Finch during the Spring '08 term at Rutgers.
- Spring '08