Plotting in MATLAB Rachel Davies Brittany Earnest Greg Fannon Nicholas Millan Khurram Najeeb.

Slides:



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

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.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Chapter Chapter 4. Think back to any very difficult quantitative problem that you had to solve in some science class How long did it take? How many times.
Programming in Visual Basic
Substitute 3 for x and 4 for y. Simplify. Write original equation. Check whether each ordered pair is a solution of the equation. SOLUTION Which ordered.
Al-Amer An Introduction to MATLAB Lesson 2: M-files Dr. Samir Al-Amer Term 061.
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Functions.
A Simple Guide to Using SPSS© for Windows
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
Physics Graphing Using Open Office. Advantages of Graphing with Spreadsheet Programs Can be fast. Handles lots of data and multiple calculations. Precise.
1 Introduction to Spreadsheets Bent Thomsen. 2 What is an electronic spreadsheet? It is the electronic equivalent of an accounting worksheet, comprised.
Non-Linear Simultaneous Equations
The graphing calculator can be a great checking tool or a fast way to answer a multiple choice question. Example – suppose you graphed the following and.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
Visual Basic Chapter 1 Mr. Wangler.
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
SOLVING & GRAPHING LINEAR EQUATIONS
Graphing Linear Equations
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Ranjeet Department of Physics & Astrophysics University of Delhi Working with Origin.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
EECE 360/460 Matlab Tutorial Jan Outline What is Matlab? What is Matlab? Matlab Interface Matlab Interface Basic Syntax Basic Syntax Plotting Graphs.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
A Brief introduction to MatLAB ($50 - $99 for students)
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
Scratch Programming Lesson 4 Question asking and answering.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Recap Sum and Product Functions Matrix Size Function Variance and Standard Deviation Random Numbers Complex Numbers.
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.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
1 DKT 211 Basic Communication Engineering LAB # 1A : (Lecture 1) Introduction to Matlab  Basic Features  Scientific features  Array Operations  Script.
Investigating Patterns Cornell Notes & Additional Activities.
1 Lecture 1 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
EGR 115 Introduction to Computing for Engineers Introduction to MATLAB Friday 29 August 2014 EGR 115 Introduction to Computing for Engineers.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
You will need Dev C++ to help you with this project. If you do not already have this programming tool on your device you can visit
EXCEL GRAPHING *Basic Graphing Steps* by A.B. -NNHS.
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
Intro to Loops 1.General Knowledge 2.Two Types of Loops 3.The WHILE loop 1.
ENG College of Engineering Engineering Education Innovation Center 1 Functions 1 in MATLAB Topics Covered: 1.Uses of Functions Organizational Tool.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
Visual Basic.NET Windows Programming
ECE 1304 Introduction to Electrical and Computer Engineering
Microsoft Excel A Spreadsheet Program.
MATLAB DENC 2533 ECADD LAB 9.
Solve a system of linear equation in two variables
UNITY TEAM PROJECT TOPICS: [1]. Unity Collaborate
3-4 Equations of Lines Name the slope and y-intercept of each equation. 1. y = ½ x + 4 m = ½ b = 4 2. y = 2 m = 0, b = 2 (horizontal line) 3. x = 5.
Nuffield Free-Standing Mathematics Activity
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Graphing Lines and Finding Slope
Using Script Files and Managing Data
Objectives Graph lines and write their equations in slope-intercept and point-slope form. Classify lines as parallel, intersecting, or coinciding.
Graphing Lines and Finding Slope
Solving Linear Equations
Presentation transcript:

Plotting in MATLAB Rachel Davies Brittany Earnest Greg Fannon Nicholas Millan Khurram Najeeb

Overview Introduction to MATLAB Plotting in MATLAB o Introduction o Creating an m-file o Graphing and Labeling Troubleshooting

What is MATLAB? computer programming interface designed to complete complex calculations and iterations in seconds rapidly produces an accurate answer increases efficiency

Who Uses MATLAB? anyone can use it most often used by engineers, physicists and people who conduct heavy calculations free trial online, but full version is expensive

What is MATLAB Used to Calculate? most often used to: o complete iterations o solve complicated equations o simplify repetitive calculations o plot functions o complete regression, linear and non-linear

What is MATLAB Used to Calculate? most often used to: o complete iterations o solve complicated equations o simplify repetitive calculations o plot functions o complete regression, linear and non-linear

Intro to Plotting in MATLAB Audience: Users with little to no knowledge of MATLAB, and basic understanding of graphing functions. What you need: Access to MATLAB, function to be graphed in the form y = mx + b. In this example we will be graphing the function y = (1/3)x + 5 from x = -10 to x = 10.

Getting Started: Creating an M-file An M-file is what allows MATLAB to compile and execute multiple lines of code at once. To create a new M-file, click File-->new-->M-file A new window should pop-up.

Commenting Comments in MATLAB code make it easy to figure out what a given function is meant to do. Comment lines always begin with % –This signifies to the program that it should not run this line of code At the end of your comments, press enter twice For example:

Defining Your Function There are two steps involved in defining the function that one wishes to graph 1.Choosing the range of values over which the function will be graphed. a. Basic code: x = x i :x j; b. For this example, x = -10:10; c. Press enter 2. Entering your function: y = (1/3)*x + 5; a. Press enter Note: the semicolons at the end of each line mean that that line of code will not be displayed in the command window when the program is run.

Creating a Graph The code to create a plot is: plot(x,y) –This tells MATLAB to plot the values of variable x on the horizontal axis and the values of variable y on the vertical axis. Do NOT end this line with a semicolon –The plot just created will not be displayed if a semicolon is present. Press enter

Labeling: Giving Context to Data Adding labels to a plot allows one to instantly tell what the plot is meant to represent by looking at it. To give your graph a title, type: title('chart title here') Press enter To label the horizontal axis of the graph, type: xlabel('horizontal title here') Press enter To label the vertical axis of the graph, type: ylabel('vertical title here’) Press enter Note: The single quotes surrounding the titles are important because they tell MATLAB that what they enclose are words, not variables.

Running the Program In order to run one's program, one must first save it. To do this, click File-->Save As and then name your program and click save. Once it has been saved, click the Run button to run the program. The run button is a green arrow that looks like this: If you have done everything correctly, a plot of your function should open in a new window. If not, check the command window for any errors that may have occurred.

Troubleshooting ErrorCauseSolution The input character is invalid in MATLAB An invalid character was used in the entry Check code for misused quotes, punctuation, or letters with accents Undefined variable at ___The variable called at this position is not defined in the program code. Check that you a calling the proper variable: capitalization matters. Check that the variable is defined before you are calling it. Unexpected MATLAB expression An expression used is valid, but not one that MATLAB recognizes Check spelling of commands

Questions?