EGR 106 – Week 7 – Functions Function concept and an example Rules for functions Local and global variables More examples Errors Application: zeroes and.

Slides:



Advertisements
Similar presentations
5.1 Modeling Data with Quadratic Functions
Advertisements

Quadratic Graph Drawing.
Solving Quadratic Equations Algebraically Lesson 2.2.
The Quadratic Formula by Zach Barr Simulation Online.
Functions MATLAB’s power comes from functions Functions allow projects to be partitioned into manageable, testable, reusable modules.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Division Example 2x - 3y + 4z = 10 x + 6y - 3z = 4 -5x + y + 2z = 3 A*X = B where A = B = >> X = A\B X =
EGR 106 – Week 8 Data Files & Functions Interacting with Data Files Functions – Concept – Examples and applications Textbook chapter ,
EGR 106 – Week 5 – Functions Function concept and an example Rules for functions Local and global variables More examples Errors Application: zeroes and.
Solving Equations by Factoring
Forms of a Quadratic Equation
5.5 Solving Quadratic Equations by Factoring
2-3 solving quadratic equations by graphing and factoring
Bell Work: Find the values of all the unknowns: R T = R T T + T = 60 R = 3 R =
Algebra 1B Chapter 9 Solving Quadratic Equations By Graphing.
The Quadratic Formula. What does the Quadratic Formula Do ? The Quadratic formula allows you to find the roots of a quadratic equation (if they exist)
Finding Real Roots of Polynomial Equations
7.4 Solving Polynomial Equations Objectives: Solve polynomial equations. Find the real zeros of polynomial functions and state the multiplicity of each.
Finding the equation of a Polynomial from the roots and a Graph.
EGR 106 – Functions Functions – Concept – Examples and applications Textbook chapter p15-165, 6.11(p 178)
Roots of Polynomials Quadratics If the roots of the quadratic equation are  and  then the factorised equation is : (x –  )(x –  ) = 0 (x –  )(x –
 Carl Gauss provided a proof of the fundamental theorem of algebra at the age of 22.  Gauss is considered the prince of mathematics.  Gauss was able.
Graphing Quadratic Equations
Solving Equations by Factoring Definition of Quadratic Equations Zero-Factor Property Strategy for Solving Quadratics.
9-4 Solving Quadratic Equations by Graphing Warm Up Warm Up Lesson Presentation Lesson Presentation California Standards California StandardsPreview.
Solving Quadratic Equations by Factoring. The quadratic equation is written in the form ax 2 + bx + c = 0 To solve quadratic equations by factoring we.
Chapter 6 Section 5. Objectives 1 Copyright © 2012, 2008, 2004 Pearson Education, Inc. Solving Quadratic Equations by Factoring Solve quadratic equations.
13.1 Introduction to Quadratic Equations
Chapter 4: Polynomial and Rational Functions. 4-2 Quadratic Equations For a quadratic equation in the form ax 2 + bx + c = 0 The quadratic Formula is.
The Factor Theorem. To factor an expression means to re-write it as a product…… 10 = 5 X 2.
PreCalculus Section 1.6 Solve quadratic equations by: a. Factoring b. Completing the square c. Quadratic formula d. Programmed calculator Any equation.
Lesson: Objectives: 5.1 Solving Quadratic Equations - Graphing  DESCRIBE the Elements of the GRAPH of a Quadratic Equation  DETERMINE a Standard Approach.
4.2 Standard Form of a Quadratic Function The standard form of a quadratic function is f(x) = ax² + bx + c, where a ≠ 0. For any quadratic function f(x)
Precalculus Section 1.8 Create and apply quadratic models Recall: A quadratic function takes the form f(x) = ax 2 + bx + c Page 43: parakeet flight problem.
Solving Quadratic Functions by Factoring. Factoring Review.
Math 20-1 Chapter 4 Quadratic Equations
3.4 Chapter 3 Quadratic Equations. x 2 = 49 Solve the following Quadratic equations: 2x 2 – 8 = 40.
April 6, 2009 You need:textbook calculator No Fantastic Five warm ups this week. Take notes and/or read section Work together if you need help –
Solving Quadratic Equations by Graphing (9-2) Objective: Solve quadratic equations by graphing. Estimate solutions of quadratic equations by graphing.
* Quadratic – Polynomial with degree 2 1. y =2(x+1) 2 2. y = -3x 2 + 2x - 6.
Warm up Factor the expression.
Quadratic Functions.
Forms of a Quadratic Equation
Solving Equations by Factoring
Quadratic Equations Chapter 5.
Chapter 4 Vocabulary Functions.
Warm Up Factor each of the following
Quadratic Graph Drawing.
Quadratic Function What’s the Use of It?.
Math 20-1 Chapter 4 Quadratic Equations
Solutions, Zeros, and Roots
Solving Equations by Factoring
1. Use the quadratic formula to find all real zeros of the second-degree polynomial
Zeros to Quadratic Functions
Solving Quadratic Equations by Factoring
6.3 Solving Quadratic Equations by Factoring
Objective Solve quadratic equations by graphing.
Quadratics Lesson 2 Objective: Vertex Form of a Quadratic.
Standard Form Quadratic Equation
Factor each of the following
Chapter 6 Section 5.
ALGEBRA II HONORS/GIFTED - REVIEW FOR TEST 2-2
Quadratic Graph Drawing.
Does the function f(x) = 3x2 + 6x have a maximum or a minimum value?
Warmup Does the function f(x) = 3x2 + 6x have a maximum or a minimum value?
Chapter 3 Quadratic Equations
Matching functions & graphs without calculators
Quadratic Graph Drawing.
5.8 Analyze Graphs of Polynomial Functions
quadratic formula. If ax2 + bx + c = 0 then
Presentation transcript:

EGR 106 – Week 7 – Functions Function concept and an example Rules for functions Local and global variables More examples Errors Application: zeroes and minima of equations Textbook chapter 6, pages

Function concept So far: – Have used Matlab’s built-in functions – Have written scripts Function ≡ reusable script – Sometimes called a subprogram – Building block for larger programs Example: converting degrees to radians

Example Function: DEG2RAD

Rules for Functions First line of the file must be of the form: function [outputs] = name(inputs) Identifies a function file List of function result variables List of any variables that the function needs Name of the function and the file (name.m)

Variables: Local vs Global Usually, once created, variables are available in the workspace until cleared Functions create their own workspace with their own local variables distinct from those in the original workspace – Functions cannot change variables within the original workspace – except through outputs – Exception – global variables can span both workspaces and be manipulated in both

Example Functions function a = tri_area(b,h) % TRI_AREA area of a right triangle % TRI_AREA(B,H) returns the area of % a right triangle with base B and height H a = 0.5*b.*h;

function [a,p] = triangle(b,h) % TRIANGLE area/perimeter calculation %[A,P] =TRIANGLE(B,H) returns the % area (A) and perimeter (P) of a % right triangle with base B %and height H a = 0.5*b.*h; p = b + h + sqrt(b.^2+h.^2);

Typical Errors Too few inputs

Too many inputs Too many outputs Wrong input type – funny result

Problem 3 % The function polyder([a b c]) can be used % to determine the derivative of the quadratic % function. The coordinates of the maximum % or minimum are found by finding the roots % of the derivative of the polynomial using the % function roots. x = roots(polyder([ a b c])); y = a*x^2 + b*x + c;