MatLab Program Used to Calculate Interactive

Slides:



Advertisements
Similar presentations
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Advertisements

Introduction to MATLAB 7 for Engineers
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Basic Elements of C++ Chapter 2.
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.
Chapter 1: An Introduction to Computers and Programming Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Input, Output, and Processing
Introduction to Computer Systems and the Java Programming Language.
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
MATLAB Technical Computing Environment. MATLAB Matlab is an interactive computing environment that enables numerical computation and data visualization.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Matlab. Textbooks Required:, by Palm (3 rd edition) Required: Introduction to MATLAB for Engineers, by Palm (3 rd edition)
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
Fundamentals of Programming 20-ENFD-112 Sections 001 to 007 Instructor: Prof. Dieter Schmidt Lecture: Monday, Wednesday 3:00-3:50 Web page
Basic Computer Organization Rashedul Hasan.. Five basic operation No matter what shape, size, cost and speed of computer we are talking about, all computer.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
BASICS OF MATLAB Engr.Mian Shahzad Iqbal Lecturer,Telecom Department University of Engineering & Technology Taxila.
Information Technology (IT). Information Technology – technology used to create, store, exchange, and use information in its various forms (business data,
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
Variables, Operators, and Expressions
Today Variable declaration Mathematical Operators Input and Output Lab
Introduction to MATLAB
ECE 1304 Introduction to Electrical and Computer Engineering
Chapter 2 Variables.
Chapter Topics The Basics of a C++ Program Data Types
Arithmetic Operations
Topics Designing a Program Input, Processing, and Output
David Kauchak CS 52 – Spring 2017
How Computers Store Variables
Chapter 2: Introduction to C++
ECE 1304 Introduction to Electrical and Computer Engineering
BASIC ELEMENTS OF A COMPUTER PROGRAM
ITEC113 Algorithms and Programming Techniques
Basic Elements of C++.
Variables, Expressions, and IO
MATLAB DENC 2533 ECADD LAB 9.
Basic Elements of C++ Chapter 2.
Computer Electronic device Accepts data - input
Mr. Dave Clausen La Cañada High School
2.1 Parts of a C++ Program.
Introduction to Java, and DrJava part 1
Introduction to MATLAB
Chapter 2 Variables.
Topics Introduction Hardware and Software How Computers Store Data
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Introduction to Java, and DrJava
Matlab.
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Chapter 2: Introduction to C++.
Topics Designing a Program Input, Processing, and Output
Experiment No. (1) - an introduction to MATLAB
Topics Designing a Program Input, Processing, and Output
CS 111 Introduction to Computing in Engineering and Science
Introduction to MATLAB
Introduction to Java, and DrJava part 1
Chapter 2 Variables.
Basic Computer Organization
Introduction to Matlab
Electrical and Computer Engineering Department SUNY – New Paltz
Presentation transcript:

MatLab Program Used to Calculate Interactive May Be Used for Programming Complex Problems Default name to store value is ans

MatLab Desktop : Command Window, Command History Window, Current Directory (Folder) Window

Terminology Main Memory – part of the computer that contains values used when running a program Identifiers – name (or label) given to a location in main memory that holds a value. Variables – location in main memory that holds a value that might change Constant – location in main memory that holds a value that will not change Statement – command for the computer in language Assignment – changing the value of a variable Expression – anything in a program that has a value Functions – a label (identifier) for code (statements) that might be run multiple times during a program

MATLAB Identifier Rules Begin with one of a–z or A–Z Have remaining characters chosen from a–z, A–Z, 0–9, or _ Have a maximum length of 31 characters Should not be the name of a built-in variable, built-in function, or user-defined function Always use descriptive identifiers

Assignment Statements Assignment – giving a variable a new value. The right hand side (a value) is evaluated and the value is assigned to the left hand side (a location) : x=5; y=3; z = x + y z gets the value 8 z=2*x+y now z gets the value 13 z=2*(x+y) ????

Expressions Expression – anything that has a value (variable, constant, literal) Operator – Symbol used to modify an expression Operand – expression modified by an operator Examples : 5 -16.3 numStudents pi numStudents + 14

Precedence Precedence - which operator is applied first in an expression having several operators. Parentheses () Exponent/Power ^ Unary plus + Unary minus - Multiplication * Division / Addition +, Subtraction -

MATLAB Functions and Constants Matlab Functions Include : sqrt(x) log(x) log10(x) cos(x), acos(x), cosd(x), acosd(x) sin(x), asin(x), sind(x), asind(x) tan(x), atan(x), tand(x), atand(x) Arguments (or parameters) – (the “x” above inside of parenthesis) must be the correct number, data type and order

MatLab Basics Semicolon (';') to suppress output Click on fx to Show Available Functions who to Show Variables and Values whos to Show Variables and Values help function to get description of function clc to clear Command Window clear to clear all variables

format Command Used to Control Format of Displayed Real Numbers Sets Current Mode of Output Default : format short Examples : format short : 4 decimal digits format long : 16 decimal digits format short e : scientific notation (exponent) format bank : 2 decimal digits

Special MatLab Names ans : default location for answer i : imaginary sqrt of -1 Inf : Infinity NaN : undefined “Not a Number” pi : π

MatLab Display disp(x) : Display the value of x value = input('prompt') : prompt User with 'prompt'; wait for User input; place User input in value stringValue = input('prompt', 's') : prompt User with 'prompt'; wait for User input; place User input in stringValue

MatLab Display stringVariable = sprintf('information') : Store information in string Variable %d – decimal value %f – floating point (real) value %s – string value %5.2f – float value with minimum width of 5 and 2 decimal places Ex. moneyLine = sprintf('Your change is %5.2f',change)

Computer Limitations Computers Are Not Infinite Computers Have Maximum Speed Computers Have Maximum Room to Store

Computer Basics Input Devices : Keyboard, Network CPU : Central Processing Unit Memory : Main Memory, Disk Memory Output Devices : Printer, Monitor

Main Memory Storage Location of Data in a Computer Used When a Program Is Running “Wiped Clean” When Computer Rebooted Bit: One Wire in Computer (generally represented by a 0 (off) or 1 (on) ) Byte: Basic Unit of Storage (Can Store One Letter of the Alphabet) (8 bits) Kilobyte (KB): 1000 (or 1024) Bytes (Pages of Text) Megabyte (MB): 1,000,000 Bytes (Large Pictures) Gigabyte (GB): 1,000,000,000 Bytes (Music Files, Video Files)