Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Lecture 14 User-defined functions Function: concept, syntax, and examples © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Lecture 5.
259 Lecture 17 Working with Data in MATLAB. Overview  In this lecture, we’ll look at some commands that are useful for working with data!  fzero  sum,
Introduction to Matlab
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
CMPS 1371 Introduction to Computing for Engineers FUNCTIONS.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
CSE 803 Using images in C++ Computing with images Applications & Methods 2D arrays in C++ Programming project 4.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
1 Introduction to MatLab MatLab stands for Matrix Laboratory. As the name suggests most of the programming operations have as input or output a matrix.
MATLAB TUTORIAL Dmitry Drutskoy Some material borrowed from the departmental MATLAB info session by Philippe Rigollet Kevin Wayne.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
259 Lecture 16 Numerical Differentiation and Integration in MATLAB; Function M-files.
Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
A Brief Introduction to Matlab Laila Guessous Dept. of Mechanical Engineering Oakland University.
EECE 360/460 Matlab Tutorial Jan Outline What is Matlab? What is Matlab? Matlab Interface Matlab Interface Basic Syntax Basic Syntax Plotting Graphs.
Numerical Computation Lecture 2: Introduction to Matlab Programming United International College.
COMP 116: Introduction to Scientific Programming Lecture 5: Plotting, Scripts and publishing.
Chapter 1: Getting Started with MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Introduction to VB.NET 2005 Dr. McDaniel IDS4704 Spring 2005.
Outline Comparison of Excel and R R Coding Example – RStudio Environment – Getting Help – Enter Data – Calculate Mean – Basic Plots – Save a Coding Script.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
COMP 116: Introduction to Scientific Programming Lecture 11: Functions.
Scientific Computing Introduction to Matlab Programming.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Barbara/Pratik/Yu. Outline Matlab desktop M-files Variables Arrays Plots.
Recap Saving Plots Summary of Chapter 5 Introduction of Chapter 6.
MCE 372 Engineering Analysis MATLAB Review. M ATLAB – What Is It ? Where Is It? Name is from matrix laboratory Powerful tool for – Computation and visualization.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
1 CS1371 Introduction to Computing for Engineers Introduction to Matlab.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
Newton’s Method, Root Finding with MATLAB and Excel
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Files: By the end of this class you should be able to: Prepare for EXAM 1. create an ASCII file describe the nature of an ASCII text Use and describe string.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
MA/CS 375 Fall 2002 Lecture 2. Motivation for Suffering All This Math and Stuff Try the Actor demo from
M ATLAB – What Is It ? Name is from matrix laboratory Powerful tool for – Computation and visualization of engineering and science mathematics – Communication.
Matlab for Engineers Matlab Environment Chapter 2.
We are tracking the position of an object as it is launched with an initial speed of 40m/s at an angle of 45 o. The system we are using to track the object.
Introduction to Literate Programming in Matlab 2WN50 – Week programming-in-matlab.pptx?dl=0.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Release Numbers MATLAB is updated regularly
Prof. Mark Glauser Created by: David Marr
Introduction to Matlab
Basic operations in Matlab
Lecture 1: Introduction
MATH 493 Introduction to MATLAB
MCE 372 Engineering Analysis
Use of Mathematics using Technology (Maltlab)
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
Presentation transcript:

Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator

Lesson 1 focuses on basic use of Matlab as a graphing calculator. In this lesson you will: Use Matlab as a simple calculator Understand the main views in the Matlab application: (Command Window, Workspace, Command History, Array Editor, Editor) Write simple scripts using the editor Use Cell Mode to run and debug scripts Publish and document the results

Overview

Example 1.1: Defining a variable in Matlab.

Things to explain: Where is the command window? How do you interpret what is in the workspace? What happens if you leave out the semicolon? What do variables represent? Do spaces matter? Is Matlab case sensitive (i.e., is x different from X )? Do line breaks matter? How do I continue a command on the next line? Type the following in the command window: x = 3;

Example 1.2: Calculating a simple formula.

Find the value of the following polynomial at x = 3 : Things to explain: Why do I need to put * between 5.2 and x? Why is y underlined in red? Type the following in the command window: y = 4.1*x*x*x - 5.2*x - 2;

Example 1.3: Using functions and predefined constants in formulas.

Find the volume ( V ) of a cylinder with a radius ( r ) of 2.5 and a height ( h ) of 7.3. The formula for the volume of a cylinder is: Things to explain: Where did pi come from? Why not volume = pi*r*r*h? What is power? How do I find out what other built-in functions Matlab has? Type the following in the command window: r = 2.5; h = 7.3; V = pi*power(r,2)*h;

Example 1.3: Plotting the graph of a function

Graph the following function on the interval 0 to 5. Things to explain: How do I see what kind of values x and y hold? Is 1x100 different from 100x1? What are the actual values that x and y hold? How do I specify the spacing between the values in x? What happens if I leave the x out of the plot command? How can I make x into a vector when it used to just be an integer (Example 1.1). Type the following in the command window:

x = linspace(0, 5); y = 4.1*power(x, 3) - 5.2*x -2; plot(x, y);

Example 1.4: Writing a script and using cell mode.

Redo Examples 1.2 and 1.3 as a script file and debug in Cell Mode.

Exercises

Now try these exercises. Create a new script called Lesson1Exercises.m When you and your partner have completed the exercises, place your card in front of your computer. If you have questions raise your hand. 1. Graph the following on the interval [0, 5]:

Summary of syntax

Lines with comments start with % Line breaks matter. Use three dots (... ) to continue on the next line Matlab is case sensitive Variables can be reassigned to any type A variable designated as a x b double has a rows and b columns

Summary of strategies

Here are some summary strategies for working with Matlab: Develop Matlab code in small steps Use Cell Mode to debug each step Try simple numbers on each thing first Watch the types of the variables in the workspace as you work Don't move code to its own function until you've thoroughly debugged it in Cell Mode Document each small piece as you go Use the Matlab publish feature to document you're work. Keep the documentation updated or you will have no idea what you have after a few months