EGR 140 Lab 6: Functions and Function Files Topics to be covered : Practice :

Size: px
Start display at page:

Download "EGR 140 Lab 6: Functions and Function Files Topics to be covered : Practice :"

Transcription

1 EGR 140 Lab 6: Functions and Function Files Topics to be covered : Creating a Function File Structure of a Function File Function Definition Line Input and Output Arguments Function Body Local and Global Variables Saving a Function File Using a User-Defined Function Examples of Simple User-Defined Functions Comparison Between Script Files and Function Files Anonymous and Inline Functions Anonymous Functions Inline Functions Function Functions Using Function Handles for Passing a Function into a Function Function Using a Function Name for Passing a Function into a Function Function Practice : ( More 2D graphics)

2

3

4

5

6 Using the graphics tools

7

8 Lab Exercises : % S C O P E, global and local variables EDU>> M=randi(40,5,5) M = % script called tryme disp(inv(m)); % M is in memory so accessible in the script (global) EDU>> tryscope % now a function called tryme function tryme( A ) disp(inv(m)); EDU>> tryme(m) Undefined function or variable 'M'. Error in tryme (line 2) disp(inv(m)); function tryme( A ) disp(inv(a));

9 EDU>> tryme(m)

10 % faux animation function plotpm(theta) clc; format long g; V0 = 120; g = -9.8; t = 0 : 0.05 : 100; Ax = 0; Ay= g; thisangle = theta *(pi/180); xvelocity = V0 * cos(thisangle); yvelocity = V0 * sin(thisangle); x = xvelocity.* t + (1/2) * Ax.* t.^2; y = yvelocity.* t + (1/2) * Ay.* t.^2; waitingtime=1.0e-40; axis([0,2000,0,800]); grid on; hold on for i=3:length(t) plot(x(i), y(i), 'ro--','linewidth',1); pause(waitingtime); plot(x(i - 1), y(i - 1), 'wo','linewidth',1); if y(i) < 0 break; plot(x(i), y(i), 'ko-','linewidth',1.25); disp('done') function plotmatrix(m,s) plot(m(:,1),m(:,2),s)

11 function matrixout = pascalmatrix(n) M = ones(n); for i = 2:n for j = 2:n M(i,j) = M(i-1,j) + M(i,j-1); matrixout = M;

12 1, 0 < t < T Plot the square wave function f (t ) = 1, T < t < 0 of for T = 1 and t increments Use the subplot command to plot along side of the above function the function F(t) = 4 π 20 k = 0 1 2k + 1 sin ( 2k + 1)πt T for the same increments and values as above. function prob15() % uses functions truesquarewave and approxsqwave subplot(1,2,1); truesquarewave() subplot(1,2,2); approxsqwave(20) function approxsqwave(iterations) T = 1; tinc = 0.01; x = -T:tinc:T; y = []; n = length(x); function truesquarewave() T = 1; x=-t:0.01:t; y=[]; for i=1:length(x) if x(i) < 0 y = [y -1]; else y= [y 1]; plot(x,y) axis([-t T ]) for t = 1:n s = 0; for k=0:iterations s = s + (1 / (2*k + 1))*sin(((2*k+1)*pi*x(t))); Ft = (4/pi)*s; y = [y Ft]; plot(x,y)

13 x = [-1 0 1]; y = [-1 1 1]; stairs (x,y,'r','linewidth',1.5); hold on; approxsqwave(15);

14 ====================================================================== function y = matrixtocolvector(m) % Assume matrix M exists; result col-major order row vector [r c] = size(m); V = [ ]; n = r * c; for i = 1:n V = [V M(i)]; % natural colum major order y = V; O R function y = matrixtocolvector(m) % Assume matrix M exists; result col-major order row vector [r c] = size(m); V = [ ]; for col = 1:c for row = 1:r V(+1) = M(row,col); y = V; function y = matrixtorowlvector(m) % Assume matrix M exists; result col-major order row vector [r c] = size(m); V = [ ]; for row = 1:r for col = 1:c V(+1) = M(row,col); y = V; O R

15 function y = matrixtorowlvector(m) % Assume matrix M exists; result col-major order row vector [r c] = size(m); V = [ ]; M = M ; n = r * c; for i = 1:n V = [V M(i)]; % natural colum major order of transpose y = V; ======================================================================= function y = vectortomatrix(v,r,c) n = length(v); % If n less than (r c ) truncate, if greater pad with 0's k = 0; M = []; for i = 1:r Mrow = []; for j = 1:c k = k + 1; if k <= n Mrow = [Mrow V(k)]; else Mrow = [Mrow 0]; M = [M ; Mrow]; y = M;

16 % OPTIONAL passign a function parameter and contour plotting function tau = Tplate(x,y) % tau is the temperature at <x,y> tau = 100*exp(-.4*((x-1)^2+0.7*(y-3)^2))+80*exp(-.2*(2*(x-5)^2+1.5*(y-1)^2)); function fvals = fongrid(x,y,fn) n = length(x); m = length(y); fvals = zeros(m,n); for j=1:n for i=1:m fvals(i,j) = fn(x(j),y(i)); % Script for contour plot a=0; b=6; n=301; x=linspace(a,b,n); c=0; d=4; m=201; y=linspace(c,d,m); TVals = fongrid(x,y,@tplate); close all v=linspace(5,100,20); contour(x,y,tvals,v); figure TY = fongrid(x,[1 2 3],@Tplate); plot(x,ty(1,:),x,ty(2,:),'--',x,ty(3,:),'-.'); xlabel('x','fontsize',14)' ylabel('temperature','fontsize',14); leg('y=1','y=2','y=3'); shg % show most recent graph window

17

18 Assignment : NOTE - due the week after spring break! You are to submit a clean hard copy of the solutions to the following problems. 1. (16 points) 2. (16 points). Construct a function called "howfar" that uses the distance formula to calculate how far the two points are apart. For example, if x = [1 2] and y = [4 6], then disp(howfar(x,y)) should display (16 points) Write a function hitthetarget(angle, xcor) using the projectile motion script above. Use your function to discover what angle should be used as a parameter so as to hit the target. (Note: show the target on your graph as a point on the ground set at x = 1000 )

19 4. (16 points) Two points on the unit circle are randomly selected. What is the probability that the length of the connecting chord is greater than 1? Write a script that simulates the process described in the problem narrative. Run your simulation MANY times to discover the answer. (Note: The equation of the unit circle is x 2 + y 2 = 1. ) 5. (16 points) A stick of length one unit is broken into two pieces. Assume that the "breakpoint" is randomly situated. On the average, how long is the shortest piece? - Write a script that simulates the process described in the problem narrative. Run your simulation MANY times to discover the answer. 6. (20 points)

LAB 1: MATLAB - Introduction to Programming. Objective:

LAB 1: MATLAB - Introduction to Programming. Objective: LAB 1: MATLAB - Introduction to Programming Objective: The objective of this laboratory is to review how to use MATLAB as a programming tool and to review a classic analytical solution to a steady-state

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for solving higher order ODEs and

More information

2D Plotting with Matlab

2D Plotting with Matlab GEEN 1300 Introduction to Engineering Computing Class Meeting #22 Monday, Nov. 9 th Engineering Computing and Problem Solving with Matlab 2-D plotting with Matlab Script files User-defined functions Matlab

More information

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Part I: Basics MATLAB Environment Getting Help Variables Vectors, Matrices, and

More information

Numerical solution of ODEs

Numerical solution of ODEs Péter Nagy, Csaba Hős 2015. H-1111, Budapest, Műegyetem rkp. 3. D building. 3 rd floor Tel: 00 36 1 463 16 80 Fax: 00 36 1 463 30 91 www.hds.bme.hu Table of contents Homework Introduction to Matlab programming

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 75 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP. Use MATLAB solvers for solving higher order ODEs and systems

More information

Example Example Example Example

Example Example Example Example 7. More Practice with Iteration and Conditionals Through Graphics We will Draw Pictures Using Three User-Defined* Graphics Functions For-Loop Problems Introduce While-Loops DrawRect DrawDisk DrawStar Rectangles

More information

Companion. Jeffrey E. Jones

Companion. Jeffrey E. Jones MATLAB7 Companion 1O11OO1O1O1OOOO1O1OO1111O1O1OO 1O1O1OO1OO1O11OOO1O111O1O1O1O1 O11O1O1O11O1O1O1O1OO1O11O1O1O1 O1O1O1111O11O1O1OO1O1O1O1OOOOO O1111O1O1O1O1O1O1OO1OO1OO1OOO1 O1O11111O1O1O1O1O Jeffrey E.

More information

Math Assignment 3 - Linear Algebra

Math Assignment 3 - Linear Algebra Math 216 - Assignment 3 - Linear Algebra Due: Tuesday, March 27. Nothing accepted after Thursday, March 29. This is worth 15 points. 10% points off for being late. You may work by yourself or in pairs.

More information

EEE161 Applied Electromagnetics Laboratory 1

EEE161 Applied Electromagnetics Laboratory 1 Dr. Milica Marković Applied Electromagnetics Laboratory page 1 EEE161 Applied Electromagnetics Laboratory 1 Instructor: Dr. Milica Marković Office: Riverside Hall 3028 Email: milica@csus.edu Web:http://gaia.ecs.csus.edu/

More information

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu MATLAB BASICS Instructor: Prof. Shahrouk Ahmadi 1. What are M-files TA: Kartik Bulusu M-files are files that contain a collection of MATLAB commands or are used to define new MATLAB functions. For the

More information

Ordinary Differential Equations (ode)

Ordinary Differential Equations (ode) Ordinary Differential Equations (ode) Numerical Methods for Solving Initial condition (ic) problems and Boundary value problems (bvp) What is an ODE? =,,...,, yx, dx dx dx dx n n 1 n d y d y d y In general,

More information

Simulink Tutorial 1 CPE562

Simulink Tutorial 1 CPE562 Simulink Tutorial 1 CPE562 Week 1 Introduction to Simulink Familiarization with Simulink blocks Sources: Constants Sinks: Display Operations: Sum, Product, Add, Divide. Mathematical operations involving

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MATLAB sessions: Laboratory 4 MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for

More information

System Simulation using Matlab

System Simulation using Matlab EE4314 Fall 2008 System Simulation using Matlab The purpose of this laboratory work is to provide experience with the Matlab software for system simulation. The laboratory work contains a guide for solving

More information

ECE2111 Signals and Systems UMD, Spring 2013 Experiment 1: Representation and manipulation of basic signals in MATLAB

ECE2111 Signals and Systems UMD, Spring 2013 Experiment 1: Representation and manipulation of basic signals in MATLAB ECE2111 Signals and Systems UMD, Spring 2013 Experiment 1: Representation and manipulation of basic signals in MATLAB MATLAB is a tool for doing numerical computations with matrices and vectors. It can

More information

4 Gaussian Mixture Models

4 Gaussian Mixture Models 4 Gaussian Mixture Models Once you have a collection of feature vectors you will need to describe their distribution. You will do this using a Gaussian Mixture Model. The GMM comprises a collection of

More information

Lab 13: Ordinary Differential Equations

Lab 13: Ordinary Differential Equations EGR 53L - Fall 2009 Lab 13: Ordinary Differential Equations 13.1 Introduction This lab is aimed at introducing techniques for solving initial-value problems involving ordinary differential equations using

More information

Matlab for Review. NDSU Matlab Review pg 1

Matlab for Review. NDSU Matlab Review pg 1 NDSU Matlab Review pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) General environment and the console Matlab for Review Simple numerical

More information

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27 1/27 MATLAB crash course 1 / 27 MATLAB crash course Cesar E. Tamayo Economics - Rutgers September 27th, 2013 2/27 MATLAB crash course 2 / 27 Program Program I Interface: layout, menus, help, etc.. I Vectors

More information

EQUATION OF A CIRCLE (CENTRE A, B)

EQUATION OF A CIRCLE (CENTRE A, B) EQUATION OF A CIRCLE (CENTRE A, B) A circle can have different centres as well as different radii. Let s now consider a more general equation for a circle with centre (a, b) and radius r Exercise 1 Consider

More information

ENGR Spring Exam 2

ENGR Spring Exam 2 ENGR 1300 Spring 013 Exam INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..

More information

1-D Convection-Diffusion Lab

1-D Convection-Diffusion Lab Computational Fluid Dynamics -D Convection-Diffusion Lab The lab. uses scientificworkplace symbolic calculus and maths editor software (SWP) This file Concevtion-Diffusion-Lab is available from Blackboard

More information

EGR 111 Heat Transfer

EGR 111 Heat Transfer EGR 111 Heat Transfer The purpose of this lab is to use MATLAB to determine the heat transfer in a 1-dimensional system. New MATLAB commands: (none) 1. Heat Transfer 101 Heat Transfer is thermal energy

More information

Assignment 6, Math 575A

Assignment 6, Math 575A Assignment 6, Math 575A Part I Matlab Section: MATLAB has special functions to deal with polynomials. Using these commands is usually recommended, since they make the code easier to write and understand

More information

Linear Inverse Problems. A MATLAB Tutorial Presented by Johnny Samuels

Linear Inverse Problems. A MATLAB Tutorial Presented by Johnny Samuels Linear Inverse Problems A MATLAB Tutorial Presented by Johnny Samuels What do we want to do? We want to develop a method to determine the best fit to a set of data: e.g. The Plan Review pertinent linear

More information

Lab 4 Motion in One-Dimension Part 2: Position, Velocity and Acceleration Graphically and Statistically (pre-requisite Lab3)

Lab 4 Motion in One-Dimension Part 2: Position, Velocity and Acceleration Graphically and Statistically (pre-requisite Lab3) Lab 4 Motion in One-Dimension Part 2: Position, Velocity and Acceleration Graphically and Statistically (pre-requisite Lab3) Objectives: To obtain an understanding of position, velocity, and acceleration

More information

2 Getting Started with Numerical Computations in Python

2 Getting Started with Numerical Computations in Python 1 Documentation and Resources * Download: o Requirements: Python, IPython, Numpy, Scipy, Matplotlib o Windows: google "windows download (Python,IPython,Numpy,Scipy,Matplotlib" o Debian based: sudo apt-get

More information

TOPIC 2 Computer application for manipulating matrix using MATLAB

TOPIC 2 Computer application for manipulating matrix using MATLAB YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 2 Computer application for manipulating matrix using MATLAB Definition of Matrices in MATLAB

More information

Computer lab for MAN460

Computer lab for MAN460 Computer lab for MAN460 (version 20th April 2006, corrected 20 May) Prerequisites Matlab is rather user friendly, and to do the first exercises, it is enough to write an m-file consisting of two lines,

More information

AMS 27L LAB #8 Winter 2009

AMS 27L LAB #8 Winter 2009 AMS 27L LAB #8 Winter 29 Solving ODE s in Matlab Objectives:. To use Matlab s ODE Solvers 2. To practice using functions and in-line functions Matlab s ODE Suite Matlab offers a suite of ODE solvers including:

More information

EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring Lab Information

EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring Lab Information EE 4314 Lab 1 Handout Control Systems Simulation with MATLAB and SIMULINK Spring 2013 1. Lab Information This is a take-home lab assignment. There is no experiment for this lab. You will study the tutorial

More information

MECH : a Primer for Matlab s ode suite of functions

MECH : a Primer for Matlab s ode suite of functions Objectives MECH 4-563: a Primer for Matlab s ode suite of functions. Review the fundamentals of initial value problems and why numerical integration methods are needed.. Introduce the ode suite of numerical

More information

Lab I. 2D Motion. 1 Introduction. 2 Theory. 2.1 scalars and vectors LAB I. 2D MOTION 15

Lab I. 2D Motion. 1 Introduction. 2 Theory. 2.1 scalars and vectors LAB I. 2D MOTION 15 LAB I. 2D MOTION 15 Lab I 2D Motion 1 Introduction In this lab we will examine simple two-dimensional motion without acceleration. Motion in two dimensions can often be broken up into two separate one-dimensional

More information

Lab I. 2D Motion. 1 Introduction. 2 Theory. 2.1 scalars and vectors LAB I. 2D MOTION 15

Lab I. 2D Motion. 1 Introduction. 2 Theory. 2.1 scalars and vectors LAB I. 2D MOTION 15 LAB I. 2D MOTION 15 Lab I 2D Motion 1 Introduction In this lab we will examine simple two-dimensional motion without acceleration. Motion in two dimensions can often be broken up into two separate one-dimensional

More information

Customizing pgstar for your models

Customizing pgstar for your models MESA Summer School 10Aug2015 Customizing pgstar for your models Monique Windju / Frank Timmes/ Emily Leiner SI 2 SPIDER Color coded notation used throughout this lecture + lab: Things you do are in yellow,

More information

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2 Solutions. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2 Solutions. Michael R. Gustafson II 'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2017 Test 2 Solutions Michael R. Gustafson II Name (please print) NET ID (please print): In keeping with the Community Standard, I have neither

More information

New Mexico Tech Hyd 510

New Mexico Tech Hyd 510 Vectors vector - has magnitude and direction (e.g. velocity, specific discharge, hydraulic gradient) scalar - has magnitude only (e.g. porosity, specific yield, storage coefficient) unit vector - a unit

More information

Homework 2: Kinematics and Dynamics of Particles Due Friday Feb 12, Pressurized tank

Homework 2: Kinematics and Dynamics of Particles Due Friday Feb 12, Pressurized tank EN40: Dynamics and Vibrations Homework 2: Kinematics and Dynamics of Particles Due Friday Feb 12, 2016 School of Engineering Brown University 1. The figure illustrates an idealized model of a gas gun (used,

More information

Unit IV: Introduction to Vector Analysis

Unit IV: Introduction to Vector Analysis Unit IV: Introduction to Vector nalysis s you learned in the last unit, there is a difference between speed and velocity. Speed is an example of a scalar: a quantity that has only magnitude. Velocity is

More information

Summer Math Packet: Incoming Calculus I* students

Summer Math Packet: Incoming Calculus I* students Summer Math Packet: Incoming Calculus I* students Directions: One of the most challenging aspects of Calculus is that it requires you to use content from all your previous math courses. You will be better

More information

1 Introduction & Objective

1 Introduction & Objective Signal Processing First Lab 13: Numerical Evaluation of Fourier Series Pre-Lab and Warm-Up: You should read at least the Pre-Lab and Warm-up sections of this lab assignment and go over all exercises in

More information

Math 308 Week 8 Solutions

Math 308 Week 8 Solutions Math 38 Week 8 Solutions There is a solution manual to Chapter 4 online: www.pearsoncustom.com/tamu math/. This online solutions manual contains solutions to some of the suggested problems. Here are solutions

More information

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Generating random numbers MATLAB has many built-in functions

More information

Introduction to SVD and Applications

Introduction to SVD and Applications Introduction to SVD and Applications Eric Kostelich and Dave Kuhl MSRI Climate Change Summer School July 18, 2008 Introduction The goal of this exercise is to familiarize you with the basics of the singular

More information

TELECOMMUNICATIONS ENGINEERING

TELECOMMUNICATIONS ENGINEERING TELECOMMUNICATIONS ENGINEERING STATISTICS 9 LAB 5. STOCHASTIC PROCESSES Aim: Introduction to stochastic processes. Bernoulli Process Let be X(t) a Bernoulli stochastic process defined by: { + with probability

More information

Things to Know and Be Able to Do Understand the meaning of equations given in parametric and polar forms, and develop a sketch of the appropriate

Things to Know and Be Able to Do Understand the meaning of equations given in parametric and polar forms, and develop a sketch of the appropriate AP Calculus BC Review Chapter (Parametric Equations and Polar Coordinates) Things to Know and Be Able to Do Understand the meaning of equations given in parametric and polar forms, and develop a sketch

More information

Matlab Section. November 8, 2005

Matlab Section. November 8, 2005 Matlab Section November 8, 2005 1 1 General commands Clear all variables from memory : clear all Close all figure windows : close all Save a variable in.mat format : save filename name of variable Load

More information

TEST 150 points

TEST 150 points Math 130 Spring 008 Name: TEST #1 @ 150 points Write neatly. Show all work. Write all responses on separate paper. Clearly label the exercises. 1. A piecewise-defined function is given. 1- x if x< f (

More information

Assignment 1b: due Tues Nov 3rd at 11:59pm

Assignment 1b: due Tues Nov 3rd at 11:59pm n Today s Lecture: n n Vectorized computation Introduction to graphics n Announcements:. n Assignment 1b: due Tues Nov 3rd at 11:59pm 1 Monte Carlo Approximation of π Throw N darts L L/2 Sq. area = N =

More information

CISE 302 Linear Control Systems Laboratory Manual

CISE 302 Linear Control Systems Laboratory Manual King Fahd University of Petroleum & Minerals CISE 302 Linear Control Systems Laboratory Manual Systems Engineering Department Revised - September 2012 2 Lab Experiment 1: Using MATLAB for Control Systems

More information

1 A Review of Correlation and Regression

1 A Review of Correlation and Regression 1 A Review of Correlation and Regression SW, Chapter 12 Suppose we select n = 10 persons from the population of college seniors who plan to take the MCAT exam. Each takes the test, is coached, and then

More information

EXPERIMENT 15. USING CONDUCTIVITY TO LOOK AT SOLUTIONS: DO WE HAVE CHARGED IONS OR NEUTRAL MOLECULES? rev 7/09

EXPERIMENT 15. USING CONDUCTIVITY TO LOOK AT SOLUTIONS: DO WE HAVE CHARGED IONS OR NEUTRAL MOLECULES? rev 7/09 EXPERIMENT 15 USING CONDUCTIVITY TO LOOK AT SOLUTIONS: DO WE AVE CARGED IONS OR NEUTRAL MOLECULES? rev 7/09 GOAL After you complete this experiment, you should have a better understanding of aqueous solutions

More information

Solving Differential Equations on 2-D Geometries with Matlab

Solving Differential Equations on 2-D Geometries with Matlab Solving Differential Equations on 2-D Geometries with Matlab Joshua Wall Drexel University Philadelphia, PA 19104 (Dated: April 28, 2014) I. INTRODUCTION Here we introduce the reader to solving partial

More information

MOL410/510 Problem Set 1 - Linear Algebra - Due Friday Sept. 30

MOL410/510 Problem Set 1 - Linear Algebra - Due Friday Sept. 30 MOL40/50 Problem Set - Linear Algebra - Due Friday Sept. 30 Use lab notes to help solve these problems. Problems marked MUST DO are required for full credit. For the remainder of the problems, do as many

More information

MATH 350: Introduction to Computational Mathematics

MATH 350: Introduction to Computational Mathematics MATH 350: Introduction to Computational Mathematics Chapter IV: Locating Roots of Equations Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Spring 2011 fasshauer@iit.edu

More information

Chapter 3 Engineering Solutions. 3.4 and 3.5 Problem Presentation

Chapter 3 Engineering Solutions. 3.4 and 3.5 Problem Presentation Chapter 3 Engineering Solutions 3.4 and 3.5 Problem Presentation Organize your work as follows (see book): Problem Statement Theory and Assumptions Solution Verification Tools: Pencil and Paper See Fig.

More information

Lecture 7 Symbolic Computations

Lecture 7 Symbolic Computations Lecture 7 Symbolic Computations The focus of this course is on numerical computations, i.e. calculations, usually approximations, with floating point numbers. However, Matlab can also do symbolic computations,

More information

Experiment 1: Linear Regression

Experiment 1: Linear Regression Experiment 1: Linear Regression August 27, 2018 1 Description This first exercise will give you practice with linear regression. These exercises have been extensively tested with Matlab, but they should

More information

Math 409/509 (Spring 2011)

Math 409/509 (Spring 2011) Math 409/509 (Spring 2011) Instructor: Emre Mengi Study Guide for Homework 2 This homework concerns the root-finding problem and line-search algorithms for unconstrained optimization. Please don t hesitate

More information

Homework 3 Solutions

Homework 3 Solutions 18-290 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 2018 Homework 3 Solutions Part One 1. (25 points) The following systems have x(t) or x[n] as input and y(t) or y[n] as output. For each

More information

MATH 350: Introduction to Computational Mathematics

MATH 350: Introduction to Computational Mathematics MATH 350: Introduction to Computational Mathematics Chapter IV: Locating Roots of Equations Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Spring 2011 fasshauer@iit.edu

More information

EE3210 Lab 3: Periodic Signal Representation by Fourier Series

EE3210 Lab 3: Periodic Signal Representation by Fourier Series City University of Hong Kong Department of Electronic Engineering EE321 Lab 3: Periodic Signal Representation by Fourier Series Prelab: Read the Background section. Complete Section 2.2(b), which asks

More information

1. Is the graph an increasing or decreasing function? Explain your answer.

1. Is the graph an increasing or decreasing function? Explain your answer. Evaluate the expression. 1. 2 4 4 4 2. 5 2. 5 5 2 5 4. 7 Using a graphing calculator, graph the function f(x) = 2 x and sketch the graph on the grid provided below. 1. Is the graph an increasing or decreasing

More information

MAT300/500 Programming Project Spring 2019

MAT300/500 Programming Project Spring 2019 MAT300/500 Programming Project Spring 2019 Please submit all project parts on the Moodle page for MAT300 or MAT500. Due dates are listed on the syllabus and the Moodle site. You should include all neccessary

More information

MATH 552 Spectral Methods Spring Homework Set 5 - SOLUTIONS

MATH 552 Spectral Methods Spring Homework Set 5 - SOLUTIONS MATH 55 Spectral Methods Spring 9 Homework Set 5 - SOLUTIONS. Suppose you are given an n n linear system Ax = f where the matrix A is tridiagonal b c a b c. A =.........,. a n b n c n a n b n with x =

More information

The Geodatabase Working with Spatial Analyst. Calculating Elevation and Slope Values for Forested Roads, Streams, and Stands.

The Geodatabase Working with Spatial Analyst. Calculating Elevation and Slope Values for Forested Roads, Streams, and Stands. GIS LAB 7 The Geodatabase Working with Spatial Analyst. Calculating Elevation and Slope Values for Forested Roads, Streams, and Stands. This lab will ask you to work with the Spatial Analyst extension.

More information

L3: Review of linear algebra and MATLAB

L3: Review of linear algebra and MATLAB L3: Review of linear algebra and MATLAB Vector and matrix notation Vectors Matrices Vector spaces Linear transformations Eigenvalues and eigenvectors MATLAB primer CSCE 666 Pattern Analysis Ricardo Gutierrez-Osuna

More information

Roberto s Notes on Differential Calculus Chapter 1: Limits and continuity Section 7. Discontinuities. is the tool to use,

Roberto s Notes on Differential Calculus Chapter 1: Limits and continuity Section 7. Discontinuities. is the tool to use, Roberto s Notes on Differential Calculus Chapter 1: Limits and continuity Section 7 Discontinuities What you need to know already: The concept and definition of continuity. What you can learn here: The

More information

Lab 6: Linear Algebra

Lab 6: Linear Algebra 6.1 Introduction Lab 6: Linear Algebra This lab is aimed at demonstrating Python s ability to solve linear algebra problems. At the end of the assignment, you should be able to write code that sets up

More information

GAUTENG DEPARTMENT OF EDUCATION PROVINCIAL EXAMINATION JUNE 2016 GRADE

GAUTENG DEPARTMENT OF EDUCATION PROVINCIAL EXAMINATION JUNE 2016 GRADE GAUTENG DEPARTMENT OF EDUCATION PROVINCIAL EXAMINATION JUNE 06 GRADE MATHEMATICS TIME: hours MARKS: 00 9 pages + diagram sheets GAUTENG DEPARTMENT OF EDUCATION PROVINCIAL EXAMINATION MATHEMATICS TIME:

More information

Math 343 Lab 7: Line and Curve Fitting

Math 343 Lab 7: Line and Curve Fitting Objective Math 343 Lab 7: Line and Curve Fitting In this lab, we explore another use of linear algebra in statistics. Specifically, we discuss the notion of least squares as a way to fit lines and curves

More information

Note: The command name is upper case in the description given by help, but must be lower case in actual use. And the backslash Anb is dierent when A i

Note: The command name is upper case in the description given by help, but must be lower case in actual use. And the backslash Anb is dierent when A i MATLAB Tutorial You need a small number of basic commands to start using MATLAB. This short tutorial describes those fundamental commands. You need to create vectors and matrices, to change them, and to

More information

MENA 9520 FME Modelling Tutorial 5 ( )

MENA 9520 FME Modelling Tutorial 5 ( ) MENA 9520 FME Modelling Tutorial 5 (25.02.2011) Task 5: Understanding type of bonding using charge-density plots Exercise 5.1: Visualizing charge density in Si: 1. mkdir charge 2. Copy a converged CTRL

More information

Prelab: Complete the prelab section BEFORE class Purpose:

Prelab: Complete the prelab section BEFORE class Purpose: Lab: Projectile Motion Prelab: Complete the prelab section BEFORE class Purpose: What is the Relationship between and for the situation of a cannon ball shot off a with an angle of from the horizontal.

More information

Homework 1 Solutions

Homework 1 Solutions 18-9 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 18 Homework 1 Solutions Part One 1. (8 points) Consider the DT signal given by the algorithm: x[] = 1 x[1] = x[n] = x[n 1] x[n ] (a) Plot

More information

Math 4: Advanced Algebra Ms. Sheppard-Brick A Quiz Review Learning Targets

Math 4: Advanced Algebra Ms. Sheppard-Brick A Quiz Review Learning Targets 5A Quiz Review Learning Targets 4.4 5.5 Key Facts Graphing one-variable inequalities (ex. x < 4 ) o Perform algebra steps to get x alone! If you multiply or divide by a negative number, you must flip the

More information

Introduction to MATLAB Practical 2

Introduction to MATLAB Practical 2 Introduction to MATLAB Practical 2 Daniel Carrera November 2016 1 Searching through data One of the most important skills in scientific computing is sorting through large datasets and extracting the information

More information

Lab 2: Photon Counting with a Photomultiplier Tube

Lab 2: Photon Counting with a Photomultiplier Tube Lab 2: Photon Counting with a Photomultiplier Tube 1 Introduction 1.1 Goals In this lab, you will investigate properties of light using a photomultiplier tube (PMT). You will assess the quantitative measurements

More information

Introduction to MatLab

Introduction to MatLab Introduction to MatLab 1 Introduction to MatLab Graduiertenkolleg Kognitive Neurobiologie Friday, 05 November 2004 Thuseday, 09 Novemer 2004 Kurt Bräuer Institut für Theoretische Physik, Universität Tübingen

More information

Chapter 8. Complex Numbers, Polar Equations, and Parametric Equations. Section 8.1: Complex Numbers. 26. { ± 6i}

Chapter 8. Complex Numbers, Polar Equations, and Parametric Equations. Section 8.1: Complex Numbers. 26. { ± 6i} Chapter 8 Complex Numbers, Polar Equations, and Parametric Equations 6. { ± 6i} Section 8.1: Complex Numbers 1. true. true. true 4. true 5. false (Every real number is a complex number. 6. true 7. 4 is

More information

2 Solving Ordinary Differential Equations Using MATLAB

2 Solving Ordinary Differential Equations Using MATLAB Penn State Erie, The Behrend College School of Engineering E E 383 Signals and Control Lab Spring 2008 Lab 3 System Responses January 31, 2008 Due: February 7, 2008 Number of Lab Periods: 1 1 Objective

More information

Chapter 4. Motion in Two Dimensions

Chapter 4. Motion in Two Dimensions Chapter 4 Motion in Two Dimensions Kinematics in Two Dimensions Will study the vector nature of position, velocity and acceleration in greater detail Will treat projectile motion and uniform circular motion

More information

= L 1 # L o = " L o. = L 1! L o

= L 1 # L o =  L o. = L 1! L o GG303 Lab 9 10/20/09 1 STRAIN I Main Topics A General deformation B Homogeneous 2-D strain and the strain ellipse C Homogeneous 3-D strain and the strain ellipsoid (Flinn Diagrams) D Comments on measuring

More information

Matter & Interactions I Fall 2016

Matter & Interactions I Fall 2016 33-151 Matter & Interactions I Fall 2016 Name (Printed) Instructor Signature for 9.P70 (a): Instructor Signature for 9.P70 (b): Instructor Signature for 9.P70 (c): Instructor Signature for 9.P71: Due Date:

More information

Matlab Sheet 4. Conditional Statements and Loops

Matlab Sheet 4. Conditional Statements and Loops Matlab Sheet 4 Conditional Statements and Loops 1. It is desired to compute the sum of the first 10 terms of the series 14k 20k 2 + 5k. k = 1,2,, Write and run the program to calculate the sum. 2. Create

More information

Laboratory handout 1 Mathematical preliminaries

Laboratory handout 1 Mathematical preliminaries laboratory handouts, me 340 2 Laboratory handout 1 Mathematical preliminaries In this handout, an expression on the left of the symbol := is defined in terms of the expression on the right. In contrast,

More information

Computational Foundations of Cognitive Science

Computational Foundations of Cognitive Science Computational Foundations of Cognitive Science Lecture 14: Inverses and Eigenvectors in Matlab; Plotting and Graphics Frank Keller School of Informatics University of Edinburgh keller@inf.ed.ac.uk February

More information

University of Alberta ENGM 541: Modeling and Simulation of Engineering Systems Laboratory #5

University of Alberta ENGM 541: Modeling and Simulation of Engineering Systems Laboratory #5 University of Alberta ENGM 54: Modeling and Simulation of Engineering Systems Laboratory #5 M.G. Lipsett, Updated 00 Integration Methods with Higher-Order Truncation Errors with MATLAB MATLAB is capable

More information

CHUNG-ANG UNIVERSITY Linear Algebra Spring Solutions to Computer Project #2

CHUNG-ANG UNIVERSITY Linear Algebra Spring Solutions to Computer Project #2 CHUNG-ANG UNIVERSITY Linear Algebra Spring 2014 s to Computer Project #2 Problem 2.1 Find the adjacency matrix for the following graph (all edges are bidirectional). P5 From the given bidirectional graph

More information

PLC Papers Created For:

PLC Papers Created For: PLC Papers Created For: Daniel Inequalities Inequalities on number lines 1 Grade 4 Objective: Represent the solution of a linear inequality on a number line. Question 1 Draw diagrams to represent these

More information

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 You can work this exercise in either matlab or mathematica. Your choice. A simple harmonic oscillator is constructed from a mass m and a spring

More information

Representing Polynomials

Representing Polynomials Lab 4 Representing Polynomials A polynomial of nth degree looks like: a n s n +a n 1 a n 1 +...+a 2 s 2 +a 1 s+a 0 The coefficients a n, a n-1,, a 2, a 1, a 0 are the coefficients of decreasing powers

More information

Learning Scientific Notebook

Learning Scientific Notebook Learning Scientific Notebook Reading and Writing in Scientific Notebook Viewing On-Screen: Zoom Factor, Invisibles Math and Text Producing the Math Symbols from Toolbars and from the Keyboard Using the

More information

Signal Processing. Young Won Lim 3/3/18

Signal Processing. Young Won Lim 3/3/18 Copyright (c) 2016 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Vector Functions & Space Curves MATH 2110Q

Vector Functions & Space Curves MATH 2110Q Vector Functions & Space Curves Vector Functions & Space Curves Vector Functions Definition A vector function or vector-valued function is a function that takes real numbers as inputs and gives vectors

More information

Computer Exercise 0 Simulation of ARMA-processes

Computer Exercise 0 Simulation of ARMA-processes Lund University Time Series Analysis Mathematical Statistics Fall 2018 Centre for Mathematical Sciences Computer Exercise 0 Simulation of ARMA-processes The purpose of this computer exercise is to illustrate

More information

PHY 111L Activity 2 Introduction to Kinematics

PHY 111L Activity 2 Introduction to Kinematics PHY 111L Activity 2 Introduction to Kinematics Name: Section: ID #: Date: Lab Partners: TA initials: Objectives 1. Introduce the relationship between position, velocity, and acceleration 2. Investigate

More information

Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer

Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer Lunds universitet Matematikcentrum Matematisk statistik Matematisk statistik allmän kurs, MASA01:A, HT-15 Laborationer General information on labs During the rst half of the course MASA01 we will have

More information

MAT 17A - UHP - DISCUSSION #10 December 1, 2015

MAT 17A - UHP - DISCUSSION #10 December 1, 2015 MAT 17A - UHP - DISCUSSION #10 December 1, 2015 PROBLEM 1. Linear recursion equations Consider the linear recursion (finite difference) equation x j+1 = L x j = a x j + b, x 0 (1), where a and b are: (i)

More information