Introduction to Matlab

Slides:



Advertisements
Similar presentations
Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
Advertisements

Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Chapter 2 Software Tools and Assembly Language Syntax.
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.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
259 Lecture 15 Introduction to MATLAB. 2 What is MATLAB?  MATLAB, which stands for “MATrix LABoratory” is a high- performance language for technical.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
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 Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Matlab Workshop 1/10/07 Lesson 1: Matlab as a graphing calculator.
Numerical Computation Lecture 2: Introduction to Matlab Programming United International College.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
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.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Introduction to Engineering MATLAB – 2 Introduction to MATLAB - 2 Agenda Defining Variables MATLAB Windows.
CMPS 1371 Introduction to Computing for Engineers MatLab.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Scientific Computing Introduction to Matlab Programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Opening MATLAB  Students, please open MATLAB now.  CLICK on the shortcut icon → Alternatively, select… start/All.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
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.
Interduction to MATLAB Manal Alotaibi Mathematics department College of science King saud university.
ENG 1181 College of Engineering Engineering Education Innovation Center 1 Script File Input – Output : Chapter 4 PLEASE HAVE STUDENTS START MATLAB NOW.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
Introduction to Programming Python Lab 8: Loops 26 February PythonLab8 lecture slides.ppt Ping Brennan
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
ECE 1304 Introduction to Electrical and Computer Engineering
Introduction to MATLAB
Release Numbers MATLAB is updated regularly
Prof. Mark Glauser Created by: David Marr
Introduction to Matlab
Lecture: MATLAB Chapter 1 Introduction
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Introduction to Programming
Basic operations in Matlab
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Matlab Workshop 9/22/2018.
EEE 244 Numerical Methods In Electrical Engineering
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Final Exam Review Part 2 - MATLAB
StatLab Matlab Workshop
MATH 493 Introduction to MATLAB
MATLAB – Basic For Loops
Use of Mathematics using Technology (Maltlab)
MATLAB Tutorial Dr. David W. Graham.
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Communication and Coding Theory Lab(CS491)
Very Old Introduction to Matlab for EGR 220
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Using Script Files and Managing Data
Scripts In 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.
Introduction to Matlab
Matlab Basics Tutorial
Introduction to MATLAB
Computer Simulation Lab
Presentation transcript:

Introduction to Matlab Dr. Milica Markovic

Finding Matlab Find matlab by going to: Start All Programs Matlab

Command Window Don’t use command window to directly type-in Matlab commands, unless you want to use Matlab as a basic calculator.

Matlab as a calculator

To write Matlab program, open a new script (editor) file first by going to File, New, Script This is a script (or editor) window! Type your Matlab code here! In Matlab you don’t have to declare variables first! I just wrote a=11 Use letters, numbers and _ (underscore) for variable names. Always start the variable name with a letter.

To run Matlab program, press F5 or the green triangle shown below. Always start the name of your file with a letter, and you can also use numbers or underscore _

Clear all command clears all variables in memory Clear all command clears all variables in memory. clc clears command window contents. Always start your code with the first two lines Clear all and clc.

More tips for naming Matlab files To save the new file as yourname.m go to File, Save As. Type yourname.m Be careful when you name a matlab file: (a) Avoid all special characters. (b) Do not use space (c) Do not start the le name with a number. (d) When you start writing your code, do not name any variables the same as the name of your file. (e) Do not name it sin, cos, or any other function that is likely to already exist.

Good code-writing practice: comments!

After running code with lot’s of computations:

To suppress printing in command window Put ; at the end of the line you want to suppress

Use Matlab to help you assemble the report When you are done with one matlab code, save the matlab file, then “publish” it, by doing the following: (a) Open the File pulldown menu (b) Select Publish conguration for new_file.m (this is your matlab le name) (c) Select Edit Publish Congurations for XYZ.m (d) A new window opens whose title is “Edit Congurations"

Selecting the type of file for publising Select doc (you should also see html, xml, latex, doc. ppt and pdf)

Now Publish the File (a) Go to File, Publish (b) Be patient it takes about 20 seconds to make a published le (c) You can then edit this le, add comments and put all doc files together (d) Finally, make a pdf from your final .doc file

Basic computation

Creating Arrays Tip: To make a column vector, separate entries with a ; or use a transpose operation g=[1 2 3]’

Colon Operator start_value: step: stop_value For example: 1:0.1:2 >> clear all >> fall2012 ans = Columns 1 through 6 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 Columns 7 through 11 1.6000 1.7000 1.8000 1.9000 2.0000 >>

Another way to make an array Linspace(start, end, how_many_points) clear all clc linspace(1,100,10) ans = 1 12 23 34 45 56 67 78 89 100 >>

Creating Matrices Tip: g(2)=4, g(4)=5, g(5)=3, g(10)->error

Ploting

Add features to graph

Sinusoidal Functions

Making Cool Graphics

This is called “Graphics Window”