Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.

Slides:



Advertisements
Similar presentations
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Advertisements

Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Python Programming: An Introduction to Computer Science
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
1 ICS103 Programming in C Lecture 3: Introduction to C (2)
Introduction to MATLAB 7 for Engineers
C programming an Introduction. Types There are only a few basic data types in C. char a character int an integer, in the range -32,767 to 32,767 long.
Al-Amer An Introduction to MATLAB Dr. Samir Al-Amer Term 062.
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.
Using Java's Math & Scanner class. Java's Mathematical functions (methods) (1)
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.
Computer Science 101 Introduction to Programming.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
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.
Computer Science 101 Introduction to Programming.
1 Lab of COMP 406 Teaching Assistant: Pei-Yuan Zhou Contact: Lab 1: 12 Sep., 2014 Introduction of Matlab (I)
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
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 Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Input, Output, and Processing
INTRODUCTION TO MATLAB LAB# 01
Computer Science 101 Introduction to Programming.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
1 MatLab Basics Jae Hoon Kim Department of Physics Kangwon National University It contains hundreds of commands to do mathematics. Graph functions, solve.
Fundamental Programming: Fundamental Programming Introduction to C++
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
1 Programming a Computer Lecture Ten. 2 Outline  A quick introduction to the programming language C  Introduction to software packages: Matlab for numerical.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Fundamentals of Programming Most.
Engr 0012 (04-1) LecNotes Engr 0012 (04-1) LecNotes Contrasting MATLAB with C MATLABC language Workspace - interactive computation No real.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
Topics Designing a Program Input, Processing, and Output
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Introduction to the C Language
Objectives You should be able to describe: Interactive Keyboard Input
Revision Lecture
ICS103 Programming in C Lecture 3: Introduction to C (2)
EGR 115 Introduction to Computing for Engineers
Variables, Expressions, and IO
Basic operations in Matlab
By: Syed Shahrukh Haider
MATLAB DENC 2533 ECADD LAB 9.
INTRODUCTION c is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs.
Introduction to the C Language
Introduction to C++ Programming
Rocky K. C. Chang September 18, 2018 (Based on Zelle and Dierbach)
Introduction to Matlab
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Topics Designing a Program Input, Processing, and Output
Experiment No. (1) - an introduction to MATLAB
Topics Designing a Program Input, Processing, and Output
DATA TYPES AND OPERATIONS
Getting Started With Coding
Presentation transcript:

Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally straight forward, but also MATLAB program code will be much shorter and simpler than an equivalent implementation in C,FORTRAN, or Java. MATLAB is an ideal language for creating prototypes of software solutions to engineering programs, and using them to validate ideas and refine project specifications. Once these issues have been worked out, the MATLAB implementation can be replaced by a C or Java implementation that enhances performance and allows for extra functionality. Currently, MATLAB is a commercial matrix laboratory package that operates as an interactive programming environment with graphical output.

Ch Professional and Student Versions of MATLAB Student edition of MATLAB is limited in: Each matrix is limited in 16,384 elements. ( i.e., 128*128 matrix) Entering and Leaving MATLAB A MATLAB session may be entered by simply typing prompt >>matlab >> >>quit click on the icon for MATLAB or STUDENT-MATLAB EDU>>

Ch Online Help >>help >>help demo >>helpdesk 13.2 Variables and variable Arithmetic The name and (data) types of MATLAB variables do not need to be declared because MATLAB does not distinguish between integer, real, and complex values. Any variable can take integer, real, or complex values Defining Variables >>x=3 x= 3 >>

Ch13-4 Variables names : (1)a mixture of letters,digits,and underscore character. (2)the first character must be a letter. (3)within 31 characters. (4)variables x and X are distinct.

Ch13-5 Program output can be suppressed by simply appending a semicolon (;) to command lines, as in >>x=3; >>x x= 3 >>

Ch13-6 More then one command may be entered on a single line if the commands are separated by commas or semicolons. >>x=3,y=4; z=5 %define and initialize variables x,y, and z Arithmetic Expressions

Ch13-7 >>2+3; %Compute the sum “2” plus “3” >>3*4; %Compute the product “3” times “4” >>4^2; %Compute “4” raised to the power of “2” >>2+3*4^2; >>(12+3*4^2)/2; Ex: >>4.0*sin(pi/4+pi/4) is

Ch Numerical Precision of MATLAB Output All arithmetic is done to double precision, which for 32-bit machines means to about 16 decimal digits of accuracy. MATLAB automatically prints integer values as integers and floating points to four decimal digits of accuracy.

Ch Built-In Mathematical Functions MATLAB has a platter if built-in functions for mathematical and scientific computations. >>x=pi/3; >>sin(x)^2 + cos(x)^2-1.0 ans = 0 >> Active Variables: When you want to know the active variables, you can use who. >>who Your variables are: ansx >>whos >>clear x

Ch13-10

Ch13-11

Ch Program Input and Output MATLAB has two functions for the basic input of variables from the keyboard and for formatted output of variables. Input of Variables from Keyboard: A=input(‘Please type the value of coefficient A:’); will print the message Please type the value of coefficient A: Formatted Output of Variables: fprintf(format,matrices or variables) Ex: >>fprintf(‘Volume of sphere=%f\n’,3/4) Volume of sphere= >> Note: (1) Matlab’s use of single quotes and C’s use of double quotes. (2) Matlab : fprintfC : printf

Ch Control Structures Control of flow in the MATLAB : logical expressions branching constructs looping constructs Logical Expressions >>3 < 5 ans= 1 >>a = 3 = = 5 a= 0 >>

Ch13-14

Ch Selection Constructs  >>a=2;b=1; >>if a<b, c=3; else c=4; end; >>c c= 4 >>

Ch Looping Constructs >> for I=1:21, c=2*i end >>