Getting started with Matlab Numerical Methods Appendix B help/techdoc/learn_matlab/learn_matlab.html.

Slides:



Advertisements
Similar presentations
Introduction to Matlab
Advertisements

StatLab Workshop Yale University Maximiliano Appendino, Economics October 18 th, 2013.
Introduction to MATLAB The language of Technical Computing.
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Zen and the Art of MatLab Damian Gordon. Hard work done by : Daphne Gilbert & Susan Lazarus.
Introduction to MATLAB ES 156 Signals and Systems 2008 Harvard SEAS.
Introduction to Matlab Οικονομίδης Δημήτρης
Dr. Jie Zou PHY Welcome to PHY 3320 Computational Methods in Physics and Engineering.
Introduction to Matlab Jianguo Wang CSSCR September 2009.
Digital Image Processing Lecture3: Introduction to MATLAB.
What is MATLAB ? MATrix LABratory –Originally, it was a front-end to FORTRAN matrix routines developed in the U. of New Mexico and Stanford –Today.
Tutorial 1: Matlab basics Erjia Yan.  Getting started  Install and use Matlab  Data format in Matlab  Export and import data in Matlab  Useful functions.
259 Lecture 15 Introduction to MATLAB. 2 What is MATLAB?  MATLAB, which stands for “MATrix LABoratory” is a high- performance language for technical.
MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.
1 Statistical Computing in MATLAB AMS 597 Ling Leng.
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
A brief introduction to MATLAB for students of Science, Engineering and Mathematics Jorge Lemagne Bindura University.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Yasser F. O. Mohammad Approximations and Round-off Errors.
Eng Ship Structures 1 Introduction to Matlab.
INTRODUCTION TO MATLAB LAB# 01
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Basics of MATLAB By DR. Wafaa Shabana
Sundermeyer MAR 550 Spring Laboratory in Oceanography: Data and Methods MAR550, Spring 2013 Miles A. Sundermeyer Introduction to Matlab ® Programming.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Matlab 14.html Cost: $100 Available in labs on Windows and Unix machines.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
Master in Optical Fiber Communications and Photonic Technologies Foundations of Digital Transmission - Fall quarter Introduction to Matlab.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
MATLAB Tutorial EE313 Signals and Systems Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Jeff Andrews.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
ECE 351 M ATLAB I NTRODUCTION ( BY T EACHING A SSISTANTS )
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
CIS 595 MATLAB First Impressions. MATLAB This introduction will give Some basic ideas Main advantages and drawbacks compared to other languages.
Introduction to Matlab Engr. Mian Shahzad Iqbal LAB NO.2
CS100A, Fall 1998, Lecture 201 CS100A, Fall 1998 Lecture 20, Tuesday Nov 10 More Matlab Concepts: plotting (cont.) 2-D arrays Control structures: while,
EEE 242 Computer Tools for Electrical Engineering Lecture I Mustafa KARABULUT.
Matlab Tutorial (material available at 1 Dr. Jim Martin Associate Professor School of Computing.
What is Matlab?  “MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB,
Prof. N. P. Jadhav Presented by. Overview of MATLAB environment MATLAB is an interactive, matrix-based system for scientific and engineering numeric computation.
MATLAB ……………….matrix laboratory. Bhushan D Patil PhD Research Scholar Department of Electrical Engineering Indian Institute of Technology, Bombay Powai,
Introduction to MATLAB
Introduction to Matlab
Introduction to Mat lab
Statistical Computing in MATLAB
INTRODUCTION TO BASIC MATLAB
MATLAB DENC 2533 ECADD LAB 9.
Introduction to Matlab
Matlab Workshop 9/22/2018.
Introduction To MATLAB
StatLab Matlab Workshop
Part I – Matlab Basics.
StatLab Workshop: Intro to Matlab for Data Analysis and Statistical Modeling 11/29/2018.
Digital Image Processing
Matlab Basic Dr. Imtiaz Hussain
Simulation And Modeling
Laboratory in Oceanography: Data and Methods
Presentation transcript:

Getting started with Matlab Numerical Methods Appendix B help/techdoc/learn_matlab/learn_matlab.html

What Is MATLAB? Math and computation Math and computation Algorithm development Algorithm development Data acquisition Data acquisition Modeling, simulation, and prototyping Modeling, simulation, and prototyping Data analysis, exploration, and visualization Data analysis, exploration, and visualization Scientific and engineering graphics Scientific and engineering graphics Application development, including graphical user interface building Application development, including graphical user interface building

The MATLAB System Development Environment. Development Environment. The MATLAB Mathematical Function Library. The MATLAB Mathematical Function Library. The MATLAB Language. The MATLAB Language. a high-level matrix/array language a high-level matrix/array language Graphics. Graphics. The MATLAB External Interfaces (API). The MATLAB External Interfaces (API).

MATLAB Online Help Desktop Tools and Development Environment Desktop Tools and Development Environment Mathematics Mathematics Programming Programming Graphics Graphics 3-D Visualization 3-D Visualization Creating Graphical User Interfaces Creating Graphical User Interfaces External Interfaces/API External Interfaces/API

Matrices and Arrays To enter D ü rer's matrix, simply type in the Command Window To enter D ü rer's matrix, simply type in the Command Window >>A = [ ; ; ; ] >>A = [ ; ; ; ] A = A =

sum, transpose, and diag sums of the columns of A sums of the columns of A >>sum(A) >>sum(A) ans = ans = >>sum(A')' >>sum(A')' ans = ans = sum(diag(A)) sum(diag(A)) ans = 34 ans = 34 The transpose operation is denoted by an apostrophe or single quote, '.

Subscripts >>A(1,4) + A(2,4) + A(3,4) + A(4,4) >>A(1,4) + A(2,4) + A(3,4) + A(4,4) ans = 34 ans = 34 >>X = A; >>X = A; >>X(4,5) = 17 >>X(4,5) = 17 X = X =

The Colon Operator >> 1:10 >> 1:10 ans = ans = >> 100:-7:50 >> 100:-7:50 ans = ans = >> 0:pi/4:pi >> 0:pi/4:pi ans = ans = In subscript In subscript >> A(1,1:4) >> A(1,1:4) ans = ans =

The magic Function >> B = magic(4) >> B = magic(4) B = B = To make this B into D ü rer's A, swap the two middle columns: To make this B into D ü rer's A, swap the two middle columns: A = B(:,[ ]) A = B(:,[ ])

Expressions Variables Variables num_students = 25 num_students = 25 Numbers Numbers e e23 1i j 3e5i e e23 1i j 3e5i Operators Operators +-*/^ +-*/^ \ Left division \ Left division Functions Functions help elfun help elfun help specfun help specfun help elmat help elmat

Working with Matrices

Generating Matrices zeros All zeros zeros All zeros ones All ones ones All ones rand Uniformly distributed random elements rand Uniformly distributed random elements randn Normally distributed random elements randn Normally distributed random elements

ones(n,m) >> ones(3,4) >> ones(3,4) ans = ans =

zeros(n,m) >> zeros(3,4) >> zeros(3,4) ans = ans =

rand(n,m) >> rand(3,4) >> rand(3,4) ans = ans =

randn(3,4) >> randn(3,4) >> randn(3,4) ans = ans =

Load and Save.mat >> A = [1 2 3] >> A = [1 2 3] >> B = [4 5 6] >> B = [4 5 6] >> save mydata.mat >> save mydata.mat >> clear >> clear >> load mydata.mat >> load mydata.mat

eye(n), eye(size(A)) >> eye(3) >> eye(3) ans = ans = >> eye(size(A)) >> eye(size(A)) ans = ans =

Load and save ASCII file >> a = magic(4); b = ones(2, 4) * -5.7; c = [ ]; >> a = magic(4); b = ones(2, 4) * -5.7; c = [ ]; >> save -ascii mydata.dat >> save -ascii mydata.dat >> clear >> clear >> load mydata.dat >> load mydata.dat >> mydata >> mydata mydata = mydata =

Building Tables >> n = (0:9)'; >> n = (0:9)'; pows = [n n.^2 2.^n] pows = [n n.^2 2.^n] pows = pows = MATLAB uses a dot, or decimal point, as part of the notation for multiplicative array operations.

Multivariate Data >>D = [ >>D = [ ] ] to obtain the mean and standard deviation of each column, use to obtain the mean and standard deviation of each column, use >>mu = mean(D), sigma = std(D) >>mu = mean(D), sigma = std(D) mu = mu = sigma = sigma = >>help datafun >>help datafun >>help stats >>help stats

Matlab Graphics

plot(x,y) t=[0:5:100] t=[0:5:100] y=t.^0.34-log10(t)+1./t y=t.^0.34-log10(t)+1./t plot(t,y) plot(t,y) title( ‘ Plot of y versus t ’ ) title( ‘ Plot of y versus t ’ ) grid grid

3D graphics [x,y]=meshgrid(-4.0:0.2:4.0,-4.0:0.2:4.0); [x,y]=meshgrid(-4.0:0.2:4.0,-4.0:0.2:4.0); z=(-20*x.^2+x)+(-15*y.^2+5.*y); z=(-20*x.^2+x)+(-15*y.^2+5.*y); surfl(x,y,z); surfl(x,y,z); axis([ ]) axis([ ]) xlabel('x-axis'); xlabel('x-axis'); ylabel('y-axis'); ylabel('y-axis'); zlabel('z-axis'); zlabel('z-axis');

Try yourself, and have fun!