* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download GCSE Mathematics
Quadratic equation wikipedia , lookup
Cubic function wikipedia , lookup
Quartic function wikipedia , lookup
Elementary algebra wikipedia , lookup
Signal-flow graph wikipedia , lookup
System of linear equations wikipedia , lookup
History of algebra wikipedia , lookup
Access Mathematics Linear Graphs & Best line fits (Least squares) Learning objectives • After the session you will be able to: • • • • • Compute the salient details of a straight line in space Find the solution to two simultaneous equations using graphical means Algebraic solutions to systems of two equations. Computer solutions to systems of equations Use a computer (and/or calculator) to compute the best line fit 2 Graphs Draw a table of values Plot the points accurately Draw a straight line or smooth curve, with a sharp pencil. Read off values accurately 3 Recap: Graphs Plot the graph y = 2x + 1 x -3 2x -6 -4 +1 1 1 y -5 Plot x and y -2 -2 1 -3 -1 0 1 -1 0 2 1 1 1 4 1 3 2 6 1 5 3 7 4 y = 2x + 1 -3 -2 -1 8 7 6 5 4 3 2 1 0 -1 0 -2 -3 -4 Run -5 -6 Rise Run 1 2 Rise 5 3 y = 3x - 2 Plot the graph y = 3x - 2 •x -3 -2 •y -11 -8 -1 0 1 2 -5 -2 1 4 2 0 -2 -4 -6 -8 -10 6 -12 -3 -2 -1 0 1 y = -2x + 3 4 2 0 MATLAB Commands: >>y=‘-2*x+3’ >>fplot(y,[0,6]) OR >>y=‘-2*x+3’ >>ezplot(y) -2 -4 -6 -8 -10 0 1 2 3 4 5 6 7 Straight line summary The equation for a straight line is always in the form: y = mx + c m is the gradient (calculated from the rise over the run). And c is simply the intercept on the y axis. Rise y NB : m Run x +ve -ve 8 Fractional coefficients -1 -1 -1 1 y x2 2 1 y x2 3 1 y 1 x 2 4 -1.5 -1.5 -1.5 -2 -2 -2 -2.5 -3 -2.5 -2.5 -3.5 -3 -4 -3.5 -4.5 -5 -4 -2 -2 00 22 4 6 9 3x + 2y = 12 How would we approach this problem Note for implicit functions you must use the ezplot command MATLAB Commands: >>ezplot(‘3*x+2*y=12) 10 2x – 3y = 18 MATLAB Commands: >>ezplot(‘2*x-3*y=18) 11 Group Discussion Sketch the graphs of the following: a) y 4 x 1 1 b) y 5 x 2 c) x y 3 12 The Intercept Method a) x y 3 b) 2 x y 4 d )3 x 2 y 6 c)3x 2 y 6 13 Learning Check Solve the following using a graphical method y=2x -1 & y= 8-x Use MATLAB to verify your results. 12 10 8 6 4 2 Commands: >> ezplot('8-x‘) 0 >> fplot(y,[0,6]) -20 1 2 3 4 5 6 >> hold on Read off or use ginput >> grid on >> y='2*x-1‘ Q. Is there a way to solve >> fplot(y,[0,6]) such problems algebraically? 14 >> fplot(y,[0,6],'r') Class Examples Time • Solve the following problems using a • • • • • graphical method and verify the results using algebra/MATLAB y=x+3 & y=7-x y=x-4 & 2x+y=5 x+y =3 & y=1-2x y=x+4 & y=3x y=2x-1 & y=3x+2 15 Finding the Line • Here’s the StarGate bit: • A point in three dimensions needs six pieces of information to be fully described. • A course therefore seven • Since a line exists essentially in 2D then only two pieces of information. • Two points • A gradient and a point 16 Example Find the equation of the line given that it passes though the points (-2,1) and (6,5) y 1 5 1 Find the Gradient m x 2 6 2 1 Find the intercept y x c 2 1 1 Any point will do 6 (5) c or 1 (2) c 2 2 17 Examples Find the equation of the line given the points (-2,4) and (4,1) expressing your answer in the form ax+by=c. 2. A line has a gradient of –0.75 and passes through a point (3,-4), state the equation of the line. 3. Find the equation of a line with a gradient of unity given that it passes through the point (-1,-2). 1. 18 Best Line Fit Consider the following data if we suspect that these must fall on a straight line what is the best way of finding the relationship (the law of the line) 10 5 0 -5 -10 -4 -2 0 2 4 19 Example: Best Line Fit Find the best line fit given the following data 10 5 Hence or otherwise 0 find the law of the line -5 -10 -4 -2 0 2 4 20 Class Discussion Time • Plot the graph given the following data: • • Find the best line fit Hence the law of the line. y x -4 -3 -2 -1 0 1 2 3 4 -9.81 -5.87 -3.18 -1.81 -2.33 1.50 3.71 5.81 7.66 21 Analytical: Best Line Fit MATLAB is a useful tool to evaluate the line of best fit for you. The procedure is: • Enter data • • x=[-4:1:4] y=[-9.81 -5.87 etc • Plot graph • plot(x,y,’x’) y x -4 -3 -2 -1 0 1 2 3 4 -9.81 -5.87 -3.18 -1.81 -2.33 1.50 3.71 5.81 7.66 22 Analytical: Best Line Fit • Fit data to line • ployfit(x,y,1) • ans=2.0545 -0.5500 • Set up function • y1=‘2.0545*x-0.5500’ • Plot the function • • hold on fplot(y1,[-4:4],’k’) 10 5 0 -5 -10 -4 -2 0 2 4 23 Group Activity: The width of keyways for various shaft diameters are given by: D 10 20 30 w 3.8 6.3 8.3 40 50 60 11.3 13.8 16.3 (1) Show that the relationship between D and W is linear and find the law of the line (2) Use MATLAB or otherwise to find the analytical law of the line 24 Lesson summary • Have we met our leaning objectives, specifically can you now: • • • • Find the solution to two simultaneous equations using graphical means Algebraic solutions to systems of two equations. Computer solutions to systems of equations Use a computer (and/or calculator) to compute the best line fit 25 Homework 1. 2. 3. Find the equation of the line given the points (-1,6) and (4,1) expressing your answer in the form ax+by=c. A line has a gradient of 1/2 and passes through a point (-2,4), state the equation of the line. Find the equation of a line with a gradient of unity given that it passes through the point (0,-4). 26 Homework During an experiment to find the coefficient of friction between two surfaces the following results were obtained. Load W (N) 10 20 30 40 50 60 Friction Force F (N) 1.5 4.3 7.6 10.4 13.5 15.6 Find the law connecting the variables in the form of: F=aW+b (You may use a computer if you wish) 27