Functions.

Slides:



Advertisements
Similar presentations
Lecture 14 User-defined functions Function: concept, syntax, and examples © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Advertisements

Solving Equations = 4x – 5(6x – 10) -132 = 4x – 30x = -26x = -26x 7 = x.
Al-Amer An Introduction to MATLAB Lesson 2: M-files Dr. Samir Al-Amer Term 061.
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
ENGG 1801 Engineering Computing MATLAB Lecture 2: Background for Week 4 Tutorial Simple Programming in MATLAB.
EGR 106 – Week 8 Data Files & Functions Interacting with Data Files Functions – Concept – Examples and applications Textbook chapter ,
Solving Quadratic Equations Tammy Wallace Varina High.
Functions. A function is a relation that has exactly one output for each input.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Do Now 10/26/10 In your notebook, explain how you know a function is a function. Then answer if the following three tables are functions or not. x
3.5 – Solving Systems of Equations in Three Variables.
Launch SpecE8 and React from GSS. You can use the chemical analyses in a GSS data sheet to set up and run SpecE8 and React calculations. Analysis → Launch…
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Week 11 Similar figures, Solutions, Solve, Square root, Sum, Term.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Solving Quadratic Equations by Factoring. Solution by factoring Example 1 Find the roots of each quadratic by factoring. factoring a) x² − 3x + 2 b) x².
Software Life Cycle What Requirements Gathering, Problem definition
Lesson 3-5: Solving Equations with the Variable on Each Side.
Write and graph direct variation equations.. 1. Solve for y : 2. Trevor ran 10 miles in 2 hours. At this rate, how far will he run in 3 hours? Determine.
COMP 116: Introduction to Scientific Programming Lecture 11: Functions.
Quadratic Relations Solving Quadratic Equations Day 2: Solve by Isolating the Variable Saturday, June 04, 20161Day 2 - Solve by Isolating the Variable.
Scientific Computing Introduction to Matlab Programming.
Objective: To graph linear equations
Functions Section 1.4. Relation The value of one variable is related to the value of a second variable A correspondence between two sets If x and y are.
3.1 You should be able to solve one-step equations using algebra. Solve for x.
Day Problems For each solution write and graph an inequality.
Newton’s Method, Root Finding with MATLAB and Excel
Solving Exponential Equations. We can solve exponential equations using logarithms. By converting to a logarithm, we can move the variable from the exponent.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Trigonometric Equations. Definition Example: Consider:
SOLVING ONE AND TWO STEP EQUATIONS. WARM – UP!! As you walk in, pick up your calculator!! We will discuss your tests as your warm-up today, so wait for.
Notes Over 5.6 Quadratic Formula
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
SCIENTIFIC DISCOVERY EXPERIMENT THEORY SCIENTIFIC COMPUTING 1.
EXAMPLE 1 Solve a triangle for the AAS or ASA case Solve ABC with C = 107°, B = 25°, and b = 15. SOLUTION First find the angle: A = 180° – 107° – 25° =
Solving Quadratic Functions by Factoring. Factoring Review.
SOLVING QUADRATICS: THE SQUARE ROOT PRINCIPLE PART 3.
Section 9.4 – Solving Differential Equations Symbolically Separation of Variables.
Complex Numbers Simplifying Addition & Subtraction 33 Multiplication.
Finding the point of intersection of two lines graphically Method 1 Find slope and y-intercept Equation must be y = mx + b form m is slope, b is y-intercept.
Copyright 2013, 2010, 2007, 2005, Pearson, Education, Inc.
Graphing Linear Equations
Today we will graph linear equations in slope intercept form.
Equations Quadratic in form factorable equations
SLOPE FIELDS & EULER’S METHOD
Computer Application in Engineering Design
Matlab Training Session 4: Control, Flow and Functions
L – Modeling and Simulating Social Systems with MATLAB
Objective: To solve two-step variable equations
Complex Numbers in Real Life
Solving Equations: The Multiplication Principle
The Fundamental Theorem of Algebra
Notes Over 9.6 An Equation with One Solution
Solving Equations with variables on each side
SYSTMES OF EQUATIONS SUBSTITUTION.
C Graphing Functions.
Graphing Linear Equations
Solving Quadratic Equations by Factoring
Notes Over 9.1 Finding Square Roots of Numbers
Solving Equations with Variables on Both Sides
Solve the equation: 6 x - 2 = 7 x + 7 Select the correct answer.
Objective- To use an equation to graph the
Functions and Tables.
3 Chapter Chapter 2 Graphing.
Equations Quadratic in form factorable equations
Using the Quadratic Formula to Solve Quadratic Equations
Exercise Every positive number has how many real square roots? 2.
More Properties of Logarithms
Reading Between the Lines!
Presentation transcript:

Functions

Review Script files – Run a list of commands Flow Control – If, for, while, etc

Functions – All variables are local variables

Example

Fibonacci Sequence Write a function that calculates the n th number in the Fibonacci Sequence

My solution

or

Multiple inputs and outputs Comments + good layout make things easier to read, correct, use and re-use.

Solving Equations Write a function that solves For real roots, otherwise displays an error. Also creates a plot of this function. And displays the real roots.

My Solution

What is the difference between a script and a m-file?

Pendulum Simulation

Inputs: – Length of pendulum – Starting pendulum angle Hints: – To start just draw the pendulum in its starting position – Use Euler rule