Solving General Linear Equations w/ Excel

Similar documents
Name Class Date. subtract 3 from each side. w 5z z 5 2 w p - 9 = = 15 + k = 10m. 10. n =

Arrays, Matrices and Determinants

An Introduction to Maple This lab is adapted from a lab created by Bob Milnikel.

Find the Relationship: An Exercise in Graphical Analysis

Matrix Inverse 2 ( 2) 1 = 2 1 2

Appendix 2: PREPARATION & INTERPRETATION OF GRAPHS

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting

Section 4.2 Graphs of Exponential Functions

FreeMat Tutorial. 3x + 4y 2z = 5 2x 5y + z = 8 x x + 3y = -1 xx

x = 12 x = 12 1x = 16

Appendix A. HINTS WHEN USING EXCEL w

Appendix 3: PREPARATION & INTERPRETATION OF GRAPHS

I. This material refers to mathematical methods designed for facilitating calculations in matrix

Finite Math - J-term Homework. Section Inverse of a Square Matrix

C1M0 Introduction to Maple Assignment Format C1M1 C1M1 Midn John Doe Section 1234 Beginning Maple Syntax any

Introduction to Excel Workshop

Using Excel This is only a brief overview that highlights some of the useful points in a spreadsheet program.

Voluntary State Curriculum Algebra II

Excel Primer CH141 Fall, 2017

Microsoft Word for Report-Writing (2016 Version)

Engineering Methods in Microsoft Excel. Part 1:

Introduction to Excel Workshop

MOVING FROM CELL TO CELL

Exercise: Graphing and Least Squares Fitting in Quattro Pro

Introduction to MATLAB

Unit 2: Accentuate the Negative Name:

[1] CURVE FITTING WITH EXCEL

UNIT I READING: GRAPHICAL METHODS

WEEK 4 REVIEW. Graphing Systems of Linear Inequalities (3.1)

Tutorial Four: Linear Regression

11.4. Imagine that you are, right now, facing a clock and reading the time on that. Spin to Win. Volume of Cones and Pyramids

Mathematical Operations with Arrays and Matrices

Lesson 3: Solving Equations; Floating-point Computation

Activity: page 1/10 Introduction to Excel. Getting Started

Technology Assignment: Limits at Infinity

Honors Precalculus: Solving equations and inequalities graphically and algebraically. Page 1

Properties. Comparing and Ordering Rational Numbers Using a Number Line

Scientific Graphing in Excel 2013

Section 1.5. Finding Linear Equations

Unit I Reading Graphical Methods

Algebra 1. 7 th Standard Complete Graphs. Categories Quadratic (p. 3-9) Exponential (p ) Absolute Value (p ) Linear (p.

PreCalculus 300. Algebra 2 Review

For more info and downloads go to: Gerrit Stols

Here is the data collected.

Experiment 1 CH Fall 2004 INTRODUCTION TO SPREADSHEETS

Sketching graphs of polynomials

Excel tutorial Introduction

SAMLab Tip Sheet #1 Translating Mathematical Formulas Into Excel s Language

ENV Laboratory 2: Graphing

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Systems of Inequalities and Linear Programming 5.7 Properties of Matrices 5.8 Matrix Inverses

Introduction to the workbook and spreadsheet

In math, the rate of change is called the slope and is often described by the ratio rise

Scientific Graphing in Excel 2007

Excel Spreadsheets and Graphs

Data Management Project Using Software to Carry Out Data Analysis Tasks

ARRAY VARIABLES (ROW VECTORS)

Performing Matrix Operations on the TI-83/84

In Google Sheets simple formulas can help you calculate important data. Learn how to create simple formulas in Google Sheets.

PRE-ALGEBRA BY MYRL SHIREMAN

Computer Packet 1 Row Operations + Freemat

Algebra 2 Semester 2 Final Exam Study Outline Semester 2 Final Exam Study Tips and Information

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392

Mastery. PRECALCULUS Student Learning Targets

UNIT 1: NUMBER LINES, INTERVALS, AND SETS

Physics 326G Winter Class 2. In this class you will learn how to define and work with arrays or vectors.

1.1 calculator viewing window find roots in your calculator 1.2 functions find domain and range (from a graph) may need to review interval notation

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Integrating ICT into mathematics at KS4&5

Convert Local Coordinate Systems to Standard Coordinate Systems

DSP First Lab 02: Introduction to Complex Exponentials

ALGEBRA 1 NOTES. Quarter 3. Name: Block

Common Core State Standards. August 2010

Today is the last day to register for CU Succeed account AND claim your account. Tuesday is the last day to register for my class

We want to determine what the graph of an exponential function y = a x looks like for all values of a such that 0 < a < 1

Labview. Masood Ejaz

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

1 Basic Mathematical Operations

lab MS Excel 2010 active cell

Graphical Analysis of Data using Microsoft Excel [2016 Version]

MAT 003 Brian Killough s Instructor Notes Saint Leo University

Module 7 Highlights. Mastered Reviewed. Sections ,

8.1 R Computational Toolbox Tutorial 3

Introduction to MATLAB

Section 4.4: Parabolas

Math 227 EXCEL / MEGASTAT Guide


Introduction to MATLAB

Dealing with Data in Excel 2013/2016

Using Excel for Graphical Analysis of Data

Using the same procedure that was used in Project 5, enter matrix A and its label into an Excel spreadsheet:

1. What specialist uses information obtained from bones to help police solve crimes?

Curriculum Map: Mathematics

Getting Started with MATLAB

f(x) = b x for b > 0 and b 1

Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

9.1 Linear Inequalities in Two Variables Date: 2. Decide whether to use a solid line or dotted line:

EGR 111 Plotting Data

An introduction to plotting data

addition + =5+C2 adds 5 to the value in cell C2 multiplication * =F6*0.12 multiplies the value in cell F6 by 0.12

Transcription:

Solving General Linear Equations w/ Ecel

Matri Operations in Ecel Ecel has commands for: Multiplication (mmult) matri multiplication Transpose (transpose) transpose a matri Determinant (mdeterm) calc the determinate Inverse (minverse) generate the matri inverse Important to remember that these commands apply to an array of cells instead of to a single cell When entering the command, you must identify the entire array where the answer will be displayed!

Practice Problem Find AB = C (2 X 4) (4 X 3) =?

Ecel Matri Multiplication First enter the two matrices (for A and B):

Ecel Matri Multiplication Good practice to label the matrices:

Ecel Matri Multiplication Shading and borders help the matrices stand out: A B = C.what size matri must C be?

Ecel Matri Multiplication An array of cells for the product must be selected in this case, a 2 3 array: Select the cells directly type mmult(array1,array2). You couldn t paste the equation into the selected cells, they are in different dimensions.

Ecel Matri Multiplication The MMULT function has two arguments: the ranges of cells to be multiplied. Remember that the order of multiplication is important.

Try this out! Ecel Matri Multiplication Using the Enter key with an array command only returns an answer in a single cell. Instead, use Ctrl + Shift + Enter keys with array functions (This only works when you highlight the solution area, then put the cursor in the top function typing area )

Ecel Matri Multiplication Answer cells formatted:

Try this out! Ecel Transpose (This only works when you highlight the solution area, then put the cursor in the top function typing area ) Use Ctrl + Shift + Enter to input command

Ecel Determinant Since determinant is a scalar, select a single cell and use Enter to input command

Ecel Matri Inversion Remember that only square matrices can have inverses

Ecel Matri Inversion Ctrl + Shift + Enter to input command

Try this out: make a matri get its inverse matri multiply these two matri to get the identity matri A X A -1 = I, the identity matri:

Solving Linear Equations - Ecel Consider these 3 linear equations with unknowns, y and z: Rewrite in matri form.

MATLAB solution: >> A=[12 32-10; 0 2 3; 7 16 5]; >> b=[-30; 11; 42]; >> =A\b = 7.0000-2.0000 5.0000

Ecel Solution Enter coefficient and constant matrices: b =

Ecel Solution Label and highlight cells for matri of unknown variables: b =

Ecel Solution Ecel does not have the convenient left division operator, so we must enter = A -1 b. Enter formula to invert A matri and multiply the result by the b matri. This can be done in two steps or with nested commands: b =

Ecel Solution Apply formula to the selected array of cells by pressing Ctrl + Shift + Enter: b =

Eercises Solve the following sets of equations using MATLAB and Ecel and check the answer 0 4 4 5 2 0 10 4 2 3 z y z z y 0 4 2 5 0 2 2 3 0 23 4 3 4 2 1 4 3 2 4 3 1 4 3 2 1

Solution 1 3 2y 4z z 2 5y 4z 10 4 0 0 A = 3-2 4 B = 10 1 0 1 y 2 1 5-4 z -4 = 3.6-2.8-1.6

Solution 2 0 4 2 5 0 2 2 3 0 23 4 3 4 2 1 4 3 2 4 3 1 4 3 2 1 A = 3 1 4-1 1 B = 23 3 0 1 1 2 2 0-2 1 1 3 0 1 5 0-2 4-4 = 6.35-8.52-0.91-16.13

Other uses of A=b and left-division So far we have been given different equations for a set of variables and solved for those variables: Coefficients are known 2 1 + 3 2 = 12 4 1 3 2 = 6 2 4 1, 2 are unknown 3-3 It is common to have eperimental measurements where the data are known but the equation or the equation coefficients are unknown. 1 2 12 6

Fitting eperimental data Suppose someone is eperimenting with a temperature controller. They apply a series of voltages and measure the resulting temperature. Voltage Temperature 2 88.78 4 95.79 6 97.45 8 107.43 10 115.85

Fitting eperimental data You have reason to believe the relationship should be linear, i.e. T = c 1 V + c 2 You know T, V You want to find c 1, c 2 Notice this is the same equation as y = m + b, so we re solving for slope and intercept.

Fitting eperimental data First, let s have a look at the data: >> V = [2:2:10]; >> T = [88.78, 95.79, 97.45, 107.43, 115.85]; >> plot (V, T, * ); Not eactly a pretty straight line. Could be - The system really is not linear - The voltage wasn t eactly what you thought - The temperature measurement is not accurate enough - Etc.

Least Squares Fitting y What line best represents the data? Forcing the line through a data point is risky The best fit might not actually go through any points

Least Squares Algorithm y Least Squares minimizes the error between the line and the data points yi m i Find the line that minimizes the sum: i ( y i m i 2 ) Data point Line

Put our data into matri form Voltage Temperature 2 88.78 4 95.79 6 97.45 8 107.43 10 115.85 We have one equation, c 1 V + c 2 = T, and 5 measurements: c 1 * 2 + c 2 = 88.78 c 1 * 4 + c 2 = 95.79 c 1 * 6 + c 2 = 97.45 c 1 * 8 + c 2 = 107.43 c 1 * 10 + c 2 = 115.85 (m * + b = y) (m * V + b = T)

Put our data into matri form c 1 * 2 + c 2 = 88.78 c 1 * 4 + c 2 = 95.79 c 1 * 6 + c 2 = 97.45 c 1 * 8 + c 2 = 107.43 c 1 * 10 + c 2 = 115.85 2 1 4 1 6 1 8 1 10 1 c1 c2 = 88.78 95.79 97.45 107.43 115.85 Now it is in a familiar form, A=b

This is over-determined 2 1 4 1 6 1 8 1 10 1 c1 c2 = 88.78 95.79 97.45 107.43 115.85 Before we said we wanted equal number of equations and unknowns for a unique solution. Here we have 5 equations and 2 unknowns. This would be redundant if the points were all eactly on a line. Since they are not, this finds the best (least-squares) compromise.

This is over-determined 2 1 4 1 6 1 8 1 10 1 c1 c2 = 88.78 95.79 97.45 107.43 115.85 A b We can use the same left-division operator to solve for c1, c2. MATLAB recognizes the system is over-determined and switches to a least-squares fit algorithm. = A\b

Solve % least square fit clear all close all V=[2:2:10]; T=[88.78,95.79,97.45,107.43,115.85]; plot(v,t,'* ); A=[2 1;4 1;6 1;8 1;10 1]; TT=transpose(T); =A\TT; hold on line_vs=linspace(0,10,10); line_ts=line_vs*(1)+(2); plot(line_vs,line_ts); = 3.2890 81.3260 Our vector components are c1, c2

Least squares fit to V, T data

Other function types Other types of functions can be fit using the same technique. Consider this data t y 0.0 0.82 0.3 0.72 0.8 0.63 1.1 0.60 1.6 0.55 2.3 0.50

Fitting a non-linear function A linear fit looks like this: You decide a decaying eponential function might be better

Fitting a non-linear function The equation we want to try is y(t) = c 1 + c 2 e -t Fitting a non-linear function does not mean the system of equations is non-linear. We will solve for c1, c2. This equation is still linear with respect to c1, c2.

Put into matri form c 1 + c 2 e -0 = 0.82 c 1 + c 2 e -0.3 = 0.72 c 1 + c 2 e -0.8 = 0.63 1 e 0 1 e 0.3 1 e 0.8 1 e 1.1 1 e 1.6 1 e 2.3 c1 c2 = 0.82 0.72 0.63 0.60 0.55 0.50

Solve clear all close all A=[1 ep(0); 1 ep(-0.3); 1 ep(-0.8); 1 ep(-1.1);1 ep(-1.6); 1 ep(-2.3)]; b=[0.82;0.72;0.63;0.60;0.55;0.50]; 1=[0;0.3;0.8;1.1; 1.6; 2.3]; plot(1,b,'*');% plot the scattering dots hold on =A\b; line_=linspace(0,2.5,20); line_y=(1)+(2)*ep(-line_); plot(line_,line_y); = 0.4760 0.3413 1 e 0 1 e 0.3 1 e 0.8 1 e 1.1 1 e 1.6 1 e 2.3 c1 c2 = 0.82 0.72 0.63 0.60 0.55 0.50 y(t) = 0.476 + 0.3413 e -t A b

New fit

Summary Curve fitting is a commonly-needed operation and can be accomplished in Matlab as an A=b problem. MATLAB s left-division operator can be used to find an eact solution in the case of equal number of equations and unknowns. It can also be used to perform a least-squares fit in the case of more equations than unknowns. Be aware though that the underlying algorithm is not the same.