Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.

Slides:



Advertisements
Similar presentations
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Advertisements

Introduction to C Programming
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Introduction to C Programming
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Guide To UNIX Using Linux Third Edition
Introduction to C Programming
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Digital Image Processing Lecture3: Introduction to MATLAB.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
January 24, 2005 Lecture 3 - By P. Lin 1 CPET 190 Lecture 3 Problem Solving with MATLAB
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
A First Program Using C#
Exam 1: Review 1.History of computers 2.Fundamentals of computer architecture 3.Developing algorithms and programs 4.Variables and data types 5.User I/O.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
1 Chapter 1 MATLAB Primer This introductory chapter is relatively short and has as its main objective the introduction of MATLAB ® to the reader. This.
Introduction to Python
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Python From the book “Think Python”
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Introduction to Programming with RAPTOR
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Getting Started with MATLAB (part2) 1. Basic Data manipulation 2. Basic Data Understanding 1. The Binary System 2. The ASCII Table 3. Creating Good Variables.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
A (VERY) SHORT INTRODUCTION TO MATLAB J.A. MARR George Mason University School of Physics, Astronomy and Computational Sciences.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Topic Review for Exam 1 0.Infrastructure: You must be able to use MATLAB, Blackboard Exams, and Blackboard submissions 1. Computer Developing algorithms.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Chapter 1: Introduction to Computers and Programming.
Completing the Problem-Solving Process
Revision Lecture
Variables, Expressions, and IO
2) Platform independent 3) Predefined functions
MATLAB DENC 2533 ECADD LAB 9.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Digital Image Processing
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Experiment No. (1) - an introduction to MATLAB
MATLAB Introduction MATLAB can be thought of as a powerful graphing calculator but with a lot more buttons! It is also a programming language, commands.
Presentation transcript:

Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1

Fundamental components of MATLAB MATLAB stands for Matrix Laboratory MATLAB = a calculator + a lot more A computing system that accepts one instruction at a time. Instructions MUST conform to a specific syntax and vocabulary. A large library of modules that provide high-level capabilities for processing data. A collection of toolboxes, providing graphical capabilities. A graphical user interface (GUI) to allow you to assemble your own professional looking software. 2

Different Windows of MATLAB Opening MATLAB in a lab: most computer on campus will have a direct shortcut on the desktop If not, use Ernie (directions online) 3 Double Click to bring up the MATLAB Interface

Running MATLAB via Citrix

5 Frame #1 “The Command Window” Frame #2 “Current Directory” Frame #3 “Workspace” Frame #4 “Command History” “Your Calculator Screen” You can do exactly as on your calculator: add, subtract, divide, multiple, use parentheses to override the order of operations… Later on, you will realize you can do a LOT more in this frame. This frame shows the files (excel, text, MATLAB files) that can immediately be used. It will show the variables that have been created. It will show all the commands executed previously.

General Setup 6

A new window: the Editor 7

8

9 "DOCK IT"

Final common setup! 10

How it will work… Type your statements here 2. Run your statements (or hit F5) 3. See your results here (Modify your statements, repeat cycle)

1. Basic Data Manipulation New vocabulary: Variables Assignment Storing values in the computer It is assumed that these terms are understood: Input Output Programmer User

1. Basic Data Manipulation Starting MATLAB on every machine usually leads to the prompt symbols >> in the command window 13

1. Basic Data Manipulation A variable is a name given for a memory location “Assigning a value to a variable” means to place a value in the memory location associated with the variable name MATLAB usually shows what the variables are - in the Command Window, but also in the Workspace.

1. Basic Data Manipulation How about solving equations? Normal algebra ≠ programming Assume the following mathematic equation: z = x + y In algebra: when z is 10 and y is 7, what is x equal to? 15 z = x + y 10 = x + 7  Solve for x, obtain _____ Look at MATLAB:

1. Basic Data Manipulation 16 Assign values to variables z and y

1. Basic Data Manipulation 17 Assign values to variables z and y Once x is on the left side, and all known variables (z and y) are on the right, MATLAB executes the command.

1. Basic Data Manipulation In MATLAB, all the known variables must be on the right side of the equal sign before executing the command. At any time, only one variable can be on the left. 18 Assign values to variables z and y Once x is on the left side, and all known variables (z and y) are on the right, MATLAB executes the command.

2. Basic Data Understanding How exactly is the data stored in the memory?  binary (i.e. machine) language: 0 and 1’s How is the number 2 represented then? Remember that the symbol we see is NOT the value represented by it. For example: what number do these represent? V|||| 19  5

2.1 The Binary System As shown on the previous slide, a number can be represented using different symbols used for different bases. In fact, any set of symbols can be created to represent numbers. In the “binary” system (base 2), there are only two symbols: 0 and 1 With just these two symbols, a computer can represent any number we want!

2.1 The Binary System Base 10Base

2.1 The Binary System How does 10 represent a 2 ? 22

2.2. The ASCII table 23 Group the 0’s and 1’s to represent what you want Done automatically!

2.2. The ASCII table For example: The symbol 2 in decimal is represented using the sequence in binary. 24

2.2. The ASCII table Even for characters… 25

The limit between calculator and programming software Although MATLAB looks like a calculator, data can be stored in ASCII format as well. Be careful: MATLAB will execute mathematical operations on characters. What does this mean? For example, in the command window, Do It Yourself (2.3) radius = 49 radius + 1 radius = ‘radius of a circle’ radius What is the expected outcome? What is the un-expected outcome?

3. Creating Good Variables This last example should make you realize the importance of good variable names: those that describe their content. Do not name a variable radius when it will contain a name, or a sentence, prefer title_radius in the example above. In the long term, it will save you time debugging (fixing errors!) 27

3. RULES To create a variable in MATLAB, simply assign it a value. When coming up with a name, follow these RULES: It cannot contain spaces: Use the underscore, or capitalizeTheFirstLetterOfAdditionalWord It cannot start with a digit. However, it can have digits in the rest of it. It cannot contain any special characters (other than the underscore of course!) It should not be any keywords MATLAB knows, or It should not be the filename of any saved files 28

3. Good HABITS Good Programming Habits applied in EGR115 It must represent its content NO one letter long variables, except for loop counters: v, t, p, x Keep it short, it will avoid typos later on If you can, include units IN MATLAB: lower case i (Square root of -1) and j already have values. Other letters are better choices. 29