Insight Through Computing 10. Plotting Continuous Functions Linspace Array Operations.

Slides:



Advertisements
Similar presentations
Lecture 5.
Advertisements

Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Introduction to Matlab
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Suggested problems from text (6 th edition) Chapter 3.1 p85 Problems 1, 4, 9, 10 Computer problems 1, 2, 4, 7 Chapter 3.2 p101 Problems 4, 15, 17, 19 Computer.
>> n=-50:50; wc=0.4*pi; >> hn=sinc(n*wc/pi)*wc/pi; >> stem(n,hn); title('Ideal LPF with cutoff frequency = 0.4 \pi')
Project 1 Lecture Notes. Table of Contents Graphing Functions & Trend Lines Demand, Revenue, Cost, and Profit Differentiation Integration Using Solver.
CIS 101: Computer Programming and Problem Solving Lecture 2 Usman Roshan Department of Computer Science NJIT.
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
1 times table 2 times table 3 times table 4 times table 5 times table
1 Introduction to MATLAB MATLAB is all of the following: 1.Computational environment 2.Plotting software 3.Programming language Typical applications: 1.Calculations.
259 Lecture 16 Numerical Differentiation and Integration in MATLAB; Function M-files.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Math 15 Lecture 7 University of California, Merced Scilab A “Very” Short Introduction.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
computer
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Vectors Lecture 11: Supporting Material Dr Kathryn Merrick Tuesday 7 th April, 2009.
Духовні символи Голосіївського району
1. Overview 2. plot in 2D 3. Plot in 3D 4. Other possible charts 5. Engineers: label your plots! 6. Plots & Polynomial Plotting 11.
MA/CS 375 Fall 2003 Lecture 3. .* Multiplication We can use the.* operator to perform multiplication entry by entry of two matrices:
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Table of Contents Logarithmic Function - Graphing Example Sketch the graph of the logarithmic function... First, write the function in its exponential.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Tables Learning Support
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Computer Science 121 Scientific Computing Winter 2016 Chapter 3 Simple Types: Numbers, Text, Booleans.
Matlab Tutorial Iman Moazzen First Session – September 11, 2013.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
Numerical Differentiation and Integration in MATLAB; Function M-files
Times Tables.
Matlab review Matlab is a numerical analysis system
MATH 493 Introduction to MATLAB
14.3: One-Sided Limits and Continuity
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
y x y = x + 2 y = x + 4 y = x – 1 y = -x – 3 y = 2x y = ½x y = 3x + 1
An example of using euler.m
Matlab Basics Tutorial
3 times tables.
6 times tables.
Presentation transcript:

Insight Through Computing 10. Plotting Continuous Functions Linspace Array Operations

Insight Through Computing Table  Plot x sin(x) Plot based on 5 points

Insight Through Computing Table  Plot x sin(x) Plot based on 9 points

Insight Through Computing Table  Plot Plot based on 200 points—looks smooth

Insight Through Computing Generating Tables and Plots x sin(x) x = linspace(0,2*pi,9); y = sin(x); plot(x,y)

Insight Through Computing linspace x = linspace(1,3,5) x : “x is a table of values” “x is an array” “x is a vector”

Insight Through Computing linspace x = linspace(0,1,101) … x :

Insight Through Computing Linspace Syntax linspace(,, ) Left Endpoint Right Endpoint Number of Points

Insight Through Computing Built-In Functions Accept Arrays x sin(x) sin And…

Insight Through Computing Return Array of Function-evals x sin(x) sin

Insight Through Computing x = linspace(0,1,200); y = exp(x); plot(x,y) x = linspace(1,10,200); y = log(x); plot(x,y) Examples

Insight Through Computing Can We Plot This? -2 <= x <= 3

Insight Through Computing Can We Plot This? -2 <= x <= 3 x = linspace(-2,3,200); y = sin(5*x).*exp(-x/2)./(1 + x.^2) plot(x,y) Array operations Yes!

Insight Through Computing Must Learn How to Operate on Arrays Look at four simpler plotting challenges.

Insight Through Computing Example 1

Insight Through Computing Scale (*) a: s: c: c = s*a

Insight Through Computing Addition a: b: c: c = a + b

Insight Through Computing Subtraction a: b: c: c = a - b

Insight Through Computing E.g.1 Sol’n x = linspace(0,4*pi,200); y1 = sin(x); y2 = cos(3*x); y3 = sin(20*x); y = 2*y1 - y2 +.1*y3; plot(x,y)

Insight Through Computing Example 2.

Insight Through Computing Exponentiation a: s: c: c = a.^s.^

Insight Through Computing Shift a: s: c: c = a + s

Insight Through Computing Reciprocation a: c: c = 1./a

Insight Through Computing E.g.2 Sol’n x = linspace(-5,5,200); y = 5./(1+ x.^2); plot(x,y)

Insight Through Computing Example 3.

Insight Through Computing Negation a: c: c = -a

Insight Through Computing Scale (/) a: s: c: c = a/s

Insight Through Computing Multiplication a: b: c: c = a.* b.*

Insight Through Computing E.g.3 Sol’n x = linspace(0,3,200); y = exp(-x/2).*sin(10*x); plot(x,y)

Insight Through Computing Example 4.

Insight Through Computing Division a: b: c: c = a./ b./

Insight Through Computing E.g.4 Sol’n x = linspace(-2*pi,2*pi,200); y = (.2*x.^3 - x)./(1.1 + cos(x)); plot(x,y)

Insight Through Computing Question Time How many errors in the following statement given that x = linspace(0,1,100): Y = (3*x.+ 1)/(1 + x^2) A. 0 B. 1 C. 2 D. 3 E. 4

Insight Through Computing Question Time How many errors in the following statement given that x = linspace(0,1,100): Y = (3*x.+ 1)/(1 + x^2) A. 0 B. 1 C. 2 D. 3 E. 4 Y = (3*x + 1)./ (1 + x.^2)

Insight Through Computing Question Time Does this assign to y the values sin(0 o ), sin(1 o ),…,sin(90 o )? x = linspace(0,pi/2,90); y = sin(x); A. Yes B. No

Insight Through Computing Question Time Does this assign to y the values sin(0 o ), sin(1 o ),…,sin(90 o )? %x = linspace(0,pi/2,90); x = linspace(0,pi/2,91); y = sin(x); A. Yes B. No

Insight Through Computing b = linspace(.1,1,100); a = 1; h = (a - b)./(a + b); P1 = pi*(a+b); P2 = pi*sqrt(2*(a^2+b.^2)); P3 = pi*sqrt(2*(a^2+b.^2)-… ((a - b).^2)/2); P4 = pi*(a + b).*(1 + h/8).^2; plot(b,P1,b,P2,b,P3,b,P4) Ellipse Perimeter Estimates

Insight Through Computing Ellipse Perimeter Estimates

Insight Through Computing Plotting an Ellipse Better:

Insight Through Computing Solution a = input(‘Major semiaxis:’); b = input(‘Minor semiaxis:’); t = linspace(0,2*pi,200); x = a*cos(t); y = b*sin(t); plot(x,y) axis equal off

Insight Through Computing a = 5, b = 3