Matlab Concise Notes
|
|
- Delphia Goodwin
- 6 years ago
- Views:
Transcription
1 Gang Wang Oct. 3, 9. Introduction Matlab stands for MATrix LABoratory and the objects of basic operations are vectors and matrices (user should be good at linear algebra). It is written in C. Matlab is an interactive/interpretative high-level language for scientific computing. () interactive: line command, easy to debug () interpretative: not pre-compiled, most time, must run within Matlab environment (3) scientific computing: high level build-in algorithms for scientific computing Algorithms + Data Structures = Programs Algorithms: Let the best mathematician work for you. Data structures: Everything is linear algebra (ODE, PDE ) Programs: made it easy Ax=B Best tutorial: Matlab help files () Use help to >> help plot () Search help files (3) Some online tutorial: google search Matlab tutorial (4) Practice!. Matlab Demonstration >> demos () data visualization Demos Matlab: More Examples Graphics: 3d plot, volume visualization 3d drawing Movie clips () toolbox demos Matlab toolbox spline construct a spline image processing edge detection (blood) statistics robust regression (3) symbolic operation x=sym('x') % create a symbolic variable, x f=/[5+4*cos(x)] ezplot(f) % plot function f(x) f=diff(f) % differentiate the function once
2 ezplot(f) f=diff(f,) % differentiate the function twice ezplot(f) g=int(int(f)) % integrate nd derivative twice ezplot(g) 3. Matlab Environment Path Current working directory, know where your programs are Workspace script echo or not echo ( ; ) Comments (%) 4. Basic Operations () Basic Mathematics Operators Example: Matlab as a calculator: 5*sin(.5^(3-pi))+/ * / ^ (power, eg. ^3=8).34e3 (=.34*^3) abs(x) sqrt(x) log(x) -- natural log log(x) (base log) exp(x) triangular functions: sin cos tan cot asin acos atan acot () Some Constants pi inf eps NaN -- not a number is an important Example >>X=[,,5,NaN, 8, 9]; >>plot(x,'ro-'); (3) Logic operators = = eq(,) ~= ne(,) < > =< >= max(a,b) min(a,b) Example: >> a=[,,3,4] >> a = = 5. Basic variables () Real Numbers
3 >>pi >>format long format short format long e format short e () Strings/Characters string= hello world string=['hello ','world'] string3=numstr(3) % convert from num to string [string,' + = ',string3] A=[,,4,8] disp(a) disp(string) sprintf('this is %d + %d = %d',,,+) %Write formatted data to string. sprintf('this is %d + %d = %.4f',,,+) sprintf('this is %d + %d \n= %.4f',,,+) disp(sprintf('this is %d + %d = %.4f',,,+)) (3) load/save variables >> clear all >> mymatrix=[,3, 5, 7, 9] >> save('savedmymatrix.mat','mymatrix') % save as.mat file >> load('savedmymatrix.mat') % load variables stored in.mat file >> load savedmymatrix % the same >> who % check variable in workspace 6. Basic Data Structurs () Vectors and matrices x=[ ] x=: x=:: x=linspace(,,3) A=[ 3 ; ; ] A(3,) Matrix operation + - * / A*B (m,n) (n*p) (m*p) Example: Solve AX=B A=[,;3,4] B=[5;6] X=inv(A)*B X=A\B % partial pivoting size(a) inv(a) 3
4 A*A trace(a) det(a) eye(3) zeros(,3) [i,j]=find(a==) eig(a) see matlab demos: matrices, basic operation () string is also stored in matrix structure (3) Structural Array. Construct the structural array >>GMXEmployee().ID=34 >>GMXEmployee().Name='Gang Wang' >>GMXEmployee().ID=567 >>GMXEmployee().Name='Miao Zhang' >>GMXEmployee.ID(). Make the query >>GMXEmployee().Name ans = Demos: matlab-> language-> structures (4) Cells Enclose the cell subscripts in parentheses using standard array notation. Enclose the cell contents on the right side of the assignment statement in curly braces, "{}." For example, create a -by- cell array A. >>A(,) = {[ 4 3; 5 8; 7 9]}; >>A(,) = {'Anne Smith'}; >>A(,) = {3+7i}; >>A(,) = {-pi:pi/:pi}; Try to calculate A(,)+, oops, function '+' not defined for variables of class 'cell'. What should we do? Convert cell to matrix first, then do calculation >>cellmat(a(,))+ ans = i >> cellmat(a(,)) Advantage of using cells:. assemble different data types. assemble data of different length, especially string variables B()={'this is a long sentence'} 4
5 B()={'this is short'} Colon notation Generate a list with start:step: a=:: %(step, from to ) a=: %(step as default) Retrieve sub-block of a matrix A=[,,3; 4,5,6; 7,8,9] A(:,) %the first column of matrix A A(,:) %the first row of matrix A A(:3, [,3])=3 SUM operation >> A = [:3; 4:6; 7:9] A = >> s = sum(a) s = 5 8 >> ss = sum(sum(a)) ss = 45 Matrix entry-to-entry operation A=[ 3]; B=[3 4 5];. Dot product: A.*B ans = Compare it with A *B = ( 3 4 5) ans = and A*B = ( 3 4 5) =6 3. Dot division: A./B ans =
6 3. Dot power : A.^ ans = Building Blocks of Structured Programming () IF statement if expression statements else statements The statements are executed if the real part of the expression has all non-zero elements. The ELSE and ELSEIF parts are optional. Zero or more ELSEIF parts can be used as well as nested IF's. The expression is usually of the form expr rop expr where rop is ==, <, >, <=, >=, or ~=. () FOR Loops Repeat statements a specific number of times. The general form of a FOR statement is: for variable = expression statement statement example: for i=['a','b', 'c'] disp(i) The BREAK statement can be used to terminate the loop prematurely. Example: for i=: disp(i) if i ==5 break (3) WHILE Loops: Repeat statements an indefinite number of times. The general form of a WHILE statement is: while expression statements 6
7 The statements are executed while the real part of the expression has all non-zero elements. The expression is usually the result of expr rop expr where rop is ==, <, >, <=, >=, or ~=. Example: eps = ; while (+eps) > eps = eps/ eps = eps* (4) SWITCH CASE: Switch among several cases based on expression. Example: METHOD='LINEAR'; switch lower(method) case {'linear','bilinear'} disp('method is linear') case 'cubic' disp('method is cubic') case 'nearest' disp('method is nearest') otherwise disp('unknown method.') 8. Matlab Scripts A script is an m-file without the function declaration at the top. Be aware that all the variables in a scripts can be altered. hit : () always use clear all to start a new script () make sure the path saved 9. Function Example: function [A] = myarea(a,b,c) % Compute the area of a triangle whose % sides have length a, b and c. % Inputs: % a,b,c: Lengths of sides % Output: % A: area of triangle % Usage: % Area = area(,3,4); 7
8 % Written by dfg, Oct 4, 996. s = (a+b+c)/; A = sqrt(s*(s-a)*(s-b)*(s-c)); >> help area >> Area = area(,5,) Change function declaration to function [A,s] = area(a,b,c) then, the returned variables are A and s >> Area = area(,5,) % by default, the st returned variable is assigned >> [Area, hlen] = area(,5,). File Operation READ/WRITE a file () fopen, fclose >> fid = fopen('sound.dat','r'); >> fclose(fid) () fgetl: Read line from file, discard newline character Example fid=fopen('fgetl.m'); while tline = fgetl(fid); if ~ischar(tline), break, disp(tline) fclose(fid); (3) fprintf: Write formatted data to file Example: x = :.:; y = [x; exp(x)]; fid = fopen('exp.txt','w'); fprintf(fid,'%6.f %.8f\n',y); fclose(fid) (4) fwrite: Write binary data to a file (5) fread: Read binary data from file 8
9 Matlab Graphics. Matlab is a powerful tool to visualize data.. Two Dimensional (-D) Plot Y=f(X). Three Dimensional (3-D) Plot Z=f(X, Y) 3. Volume Data (4-D) Visualization X, Y, Z, V(X, Y, Z). Two Dimensional (-D) Plot () Linear -D plot command Syntax Syntax plot(y) plot(x,y,...) plot(x,y,linespec,...) plot(...,'propertyname',propertyvalue,...) h = plot(...) Example: x = -pi:pi/:pi; y = tan(sin(x)) - sin(tan(x)); plot(x,y) Use File-> Save; Edit->Copy Figure in the control bar to save/copy the figure Use arrow and double click the graphic to open Graphic Property panel. () Use short symbols to specify COLOR, MARKER, LINE TYPE plot(x,y,'ro-'); % r red; o circle, - solid line plot(x,y,'g*:'); % g green; * - star, : dot line 9
10 (3) Specification of other graphic properties You can also specify other line characteristics using graphics properties. The most commonly used graphic properties are: Color -- Three ways to assign color in Matlab LineWidth - specifies the width (in points) of the line. MarkerEdgeColor - specifies the color of the marker or the edge color for filled markers (circle, square, diamond, pentagram, hexagram, and the four triangles). MarkerFaceColor - specifies the color of the face of filled markers. MarkerSize - specifies the size of the marker in units of points. Examples: h=plot(x,y,'--rs','linewidth',, 'MarkerEdgeColor','k', 'MarkerFaceColor','g','MarkerSize',)
11 Important Concept: Use Object Handle to Operate gca -- get current axes handle gcf -- get current figure handle Examples: set(gca,'color','k') % gca get current axes set(gcf,'color','y') % gcf get current figure set(gcf,'color','yellow') set(gcf,'color',[,,]) set(gcf,'color',[,.5,.5]) % another fancy color h=plot(x,y,'g*:'); % set h as handle of the line object set(h, 'Color', 'b'); % set the handle object (line) to blue get(h,'color'); % use get command to get color property of the handle object (i.e. line) get(h,'linewidth') set(h,'markersize',5) (4) More Operations on the Figure h=plot(x,y,'g*:'); xlabel('x value') ylabel('y value') title('my first plot') 3 my first plot y value x value grid on grid off h=plot(x,-y,'bo-'); % first figure was erased!! What should we do?
12 HOLD ON to plot multiple lines in the same figure, until you HOLD OFF h=plot(x,y,'g*:'); hold on; h=plot(x,-y,'bo-'); Now put in label, and change the font size of the lable hh=ylabel('y value') set(hh,'fontsize',4) Put a text on the figure text(,5,'my comments') Put on leg leg('st Line','nd Line',3) % note that the last entry is the position; try,, 3, 4 Save current figure to windows bitmap file saveas(gcf, 'output', 'bmp') You can save to other formats: tiff, jpeg, eps, pdf. (5) subplot clf % clear figure income = [ ]; outgo = [ ]; subplot(,,); plot(income) subplot(,,); plot(outgo) You can also make x subplots like this (6) Other D plot commands: loglog( ) semilogx( ) semilogy( ). Three Dimensional (3D) Plot
13 () Linear 3-D plot command: plot3 Syntax plot3(x,y,z,...) plot3(x,y,z,linespec,...) plot3(...,'propertyname',propertyvalue,...) h = plot3(...) Example: t = :pi/5:*pi; h=plot3(sin(t),cos(t),t) grid on axis square set(h,'color','r','linewidth',3,'linestyle',':') change view angle: [,,] by default, you can manually rotate the view view([,,]) () D surface plot SURF : 3-D shaded surface plot SURFC: 3-D shaded surface plot with contour SURFL: 3-D shaded surface with lighting. Display a surface and contour plot of the peaks surface. [X,Y,Z] = peaks(3); % peaks is just a 3D function surf(x,y,z) % can use surf(x,y,z), then the plot is without contour colormap hsv % choose colormap scheme axis([ ]) % specify the range of axis 3
14 Try surf(x,y,z) Add on color bar colorbar % show colorbar % change colormap scheme to jet colormap jet Change shading to interpolated scheme shading interp; colormap(pink); Other important commands: meshgrid; mesh; [X,Y] = meshgrid(-:.5:, -:.5:); % construct X,Y grids Z = X.* exp(-x.^ - Y.^); mesh(x,y,z) surf(x,y,z) 4
15 Note: NaN data is NOT visualized! % assign some z values as NaN in the middle rectangular area Z(7:3, 7:3)=NaN; surf(z) This example shows a hole in the figure! Demostration >> demos Choose Matlab -> Graphics 3D plot Transparency 5
16 3. Volume Data (4-D) Visualization Example : isosurface, isonormal data = cat(3, [. ;.3 ; ], [.. ; ;..7 ], [.4.;..4 ;.. ]); data = interp3(data,3,'cubic'); subplot(,,) p = patch(isosurface(data,.5), 'FaceColor','red','EdgeColor','none'); view(3); daspect([,,]); axis tight camlight; camlight(-8,-); lighting phong; title('triangle Normals') subplot(,,) p = patch(isosurface(data,.5), 'FaceColor','red','EdgeColor','none'); isonormals(data,p) view(3); daspect([ ]); axis tight camlight; camlight(-8,-); lighting phong; title('data Normals') Example Slices of volumetric data [x,y,z] = meshgrid(-:.:,-:.5:,-:.6:); v = x.*exp(-x.^-y.^-z.^); xslice = [-.,.8,]; yslice = ; zslice = [-,]; slice(x,y,z,v,xslice,yslice,zslice) colormap hsv 6
17 Example 3 Isosurface, isocaps, coneplot, and streamlines of wind data load wind % load wind data, it contains u v w x y z variables spd = sqrt(u.*u + v.*v + w.*w); p = patch(isosurface(x,y,z,spd, 4)); isonormals(x,y,z,spd, p) set(p, 'FaceColor', 'red', 'EdgeColor', 'none'); p = patch(isocaps(x,y,z,spd, 4)); 7
PROGRAMMING WITH MATLAB WEEK 6
PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines
More informationMatlab Tutorial 1: Working with variables, arrays, and plotting
Matlab Tutorial 1: Working with variables, arrays, and plotting Setting up Matlab First of all, let's make sure we all have the same layout of the different windows in Matlab. Go to Home Layout Default.
More informationGraphics in MATLAB. Responsible teacher: Anatoliy Malyarenko. November 10, Abstract. Basic Plotting Commands
Graphics in MATLAB Responsible teacher: Anatoliy Malyarenko November 10, 2003 Contents of the lecture: Two-dimensional graphics. Formatting graphs. Three-dimensional graphics. Specialised plots. Abstract
More informationGUI Alternatives. Syntax. Description. MATLAB Function Reference plot. 2-D line plot
MATLAB Function Reference plot 2-D line plot GUI Alternatives Use the Plot Selector to graph selected variables in the Workspace Browser and the Plot Catalog, accessed from the Figure Palette. Directly
More informationLogical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression.
What is the answer? >> Logical Subscripting: This kind of subscripting can be done in one step by specifying the logical operation as the subscripting expression. The finite(x)is true for all finite numerical
More informationMechanical Engineering Department Second Year (2015)
Lecture 7: Graphs Basic Plotting MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. This section describes a few of the most
More informationWhat is Matlab? The command line Variables Operators Functions
What is Matlab? The command line Variables Operators Functions Vectors Matrices Control Structures Programming in Matlab Graphics and Plotting A numerical computing environment Simple and effective programming
More informationIntroduction to MATLAB
Computational Photonics, Seminar 0 on Introduction into MATLAB, 3.04.08 Page Introduction to MATLAB Operations on scalar variables >> 6 6 Pay attention to the output in the command window >> b = b = >>
More informationSGN Introduction to Matlab
SGN-84007 Introduction to Matlab Lecture 4: Data Visualization Heikki Huttunen Alessandro Foi October 10, 2016 Outline Basics: figure, axes, handles, properties; Plotting univariate and multivariate data;
More information3D plot of a surface in Matlab
3D plot of a surface in Matlab 3D plot of a surface in Matlab Create a surface of function mesh Graphics 3-D line plot Graphics 3-D contour plot Draw contours in volume slice planes For 3-D shaded surface
More informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More informationCSE 123. Plots in MATLAB
CSE 123 Plots in MATLAB Easiest way to plot Syntax: ezplot(fun) ezplot(fun,[min,max]) ezplot(fun2) ezplot(fun2,[xmin,xmax,ymin,ymax]) ezplot(fun) plots the expression fun(x) over the default domain -2pi
More informationWhat is Matlab? A software environment for interactive numerical computations
What is Matlab? A software environment for interactive numerical computations Examples: Matrix computations and linear algebra Solving nonlinear equations Numerical solution of differential equations Mathematical
More informationMATLAB Tutorial. 1. The MATLAB Windows. 2. The Command Windows. 3. Simple scalar or number operations
MATLAB Tutorial The following tutorial has been compiled from several resources including the online Help menu of MATLAB. It contains a list of commands that will be directly helpful for understanding
More informationConstraint-based Metabolic Reconstructions & Analysis H. Scott Hinton. Matlab Tutorial. Lesson: Matlab Tutorial
1 Matlab Tutorial 2 Lecture Learning Objectives Each student should be able to: Describe the Matlab desktop Explain the basic use of Matlab variables Explain the basic use of Matlab scripts Explain the
More informationBasic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures
Basic plotting commands Types of plots Customizing plots graphically Specifying color Customizing plots programmatically Exporting figures Matlab is flexible enough to let you quickly visualize data, and
More informationChapter 1 Introduction to MATLAB
Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,
More informationIntroduction to Matlab
Introduction to Matlab By:Mohammad Sadeghi *Dr. Sajid Gul Khawaja Slides has been used partially to prepare this presentation Outline: What is Matlab? Matlab Screen Basic functions Variables, matrix, indexing
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationIntroduction to Programming in MATLAB
Introduction to Programming in MATLAB User-defined Functions Functions look exactly like scripts, but for ONE difference Functions must have a function declaration Help file Function declaration Outputs
More informationChapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1
Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values
More informationINTRODUCTION TO MATLAB PLOTTING WITH MATLAB
1 INTRODUCTION TO MATLAB PLOTTING WITH MATLAB Plotting with MATLAB x-y plot Plotting with MATLAB MATLAB contains many powerful functions for easily creating plots of several different types. Command plot(x,y)
More informationMATLAB Tutorial. Digital Signal Processing. Course Details. Topics. MATLAB Environment. Introduction. Digital Signal Processing (DSP)
Digital Signal Processing Prof. Nizamettin AYDIN naydin@yildiz.edu.tr naydin@ieee.org http://www.yildiz.edu.tr/~naydin Course Details Course Code : 0113620 Course Name: Digital Signal Processing (Sayısal
More informationExperiment 1: Introduction to MATLAB I. Introduction. 1.1 Objectives and Expectations: 1.2 What is MATLAB?
Experiment 1: Introduction to MATLAB I Introduction MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing numerical and symbolic calculations, and is widely used in science
More informationIntroduction to MatLab. Introduction to MatLab K. Craig 1
Introduction to MatLab Introduction to MatLab K. Craig 1 MatLab Introduction MatLab and the MatLab Environment Numerical Calculations Basic Plotting and Graphics Matrix Computations and Solving Equations
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationLecturer: Keyvan Dehmamy
MATLAB Tutorial Lecturer: Keyvan Dehmamy 1 Topics Introduction Running MATLAB and MATLAB Environment Getting help Variables Vectors, Matrices, and linear Algebra Mathematical Functions and Applications
More informationIntroduction to MATLAB for Numerical Analysis and Mathematical Modeling. Selis Önel, PhD
Introduction to MATLAB for Numerical Analysis and Mathematical Modeling Selis Önel, PhD Advantages over other programs Contains large number of functions that access numerical libraries (LINPACK, EISPACK)
More informationLab of COMP 406 Introduction of Matlab (II) Graphics and Visualization
Lab of COMP 406 Introduction of Matlab (II) Graphics and Visualization Teaching Assistant: Pei-Yuan Zhou Contact: cspyzhou@comp.polyu.edu.hk Lab 2: 19 Sep., 2014 1 Review Find the Matlab under the folder
More informationMatlab Tutorial and Exercises for COMP61021
Matlab Tutorial and Exercises for COMP61021 1 Introduction This is a brief Matlab tutorial for students who have not used Matlab in their programming. Matlab programming is essential in COMP61021 as a
More informationWhat is MATLAB? It is a high-level programming language. for numerical computations for symbolic computations for scientific visualizations
What is MATLAB? It stands for MATrix LABoratory It is developed by The Mathworks, Inc (http://www.mathworks.com) It is an interactive, integrated, environment for numerical computations for symbolic computations
More informationWhat is MATLAB? What is MATLAB? Programming Environment MATLAB PROGRAMMING. Stands for MATrix LABoratory. A programming environment
What is MATLAB? MATLAB PROGRAMMING Stands for MATrix LABoratory A software built around vectors and matrices A great tool for numerical computation of mathematical problems, such as Calculus Has powerful
More informationCDA5530: Performance Models of Computers and Networks. Chapter 8: Using Matlab for Performance Analysis and Simulation
CDA5530: Performance Models of Computers and Networks Chapter 8: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationINTRODUCTION TO NUMERICAL ANALYSIS
INTRODUCTION TO NUMERICAL ANALYSIS Cho, Hyoung Kyu Department of Nuclear Engineering Seoul National University 0. MATLAB USAGE 1. Background MATLAB MATrix LABoratory Mathematical computations, modeling
More informationIntroduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices
Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are
More informationMore on Plots. Dmitry Adamskiy 30 Nov 2011
More on Plots Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 3 Nov 211 1 plot3 (1) Recall that plot(x,y), plots vector Y versus vector X. plot3(x,y,z), where x, y and z are three vectors of the same length, plots
More informationPrepared by: Khairul Anuar Ishak Department of Electrical, Electronic & System Engineering Faculty of Engineering Universiti Kebangsaan Malaysia
MATLAB Tutorial of Fundamental Programming Prepared by: Khairul Anuar Ishak Department of Electrical, Electronic & System Engineering Faculty of Engineering Universiti Kebangsaan Malaysia MATLAB tutorial
More informationGetting Started. Chapter 1. How to Get Matlab. 1.1 Before We Begin Matlab to Accompany Lay s Linear Algebra Text
Chapter 1 Getting Started How to Get Matlab Matlab physically resides on each of the computers in the Olin Hall labs. See your instructor if you need an account on these machines. If you are going to go
More informationBasic Graphs. Dmitry Adamskiy 16 November 2011
Basic Graphs Dmitry Adamskiy adamskiy@cs.rhul.ac.uk 16 November 211 1 Plot Function plot(x,y): plots vector Y versus vector X X and Y must have the same size: X = [x1, x2 xn] and Y = [y1, y2,, yn] Broken
More informationComputational Photonics, Seminar 01 on Introduction into MATLAB, Page 1
Computational Photonics, Seminar 0 on Introduction into MATLAB,.04.06 Page Introduction to MATLAB Operations on scalar variables >> a=6 6 Pay attention to the response from the workspace >> b= b = >> a+b
More informationMath Sciences Computing Center. University ofwashington. September, Fundamentals Making Plots Printing and Saving Graphs...
Introduction to Plotting with Matlab Math Sciences Computing Center University ofwashington September, 1996 Contents Fundamentals........................................... 1 Making Plots...........................................
More informationINTERNATIONAL EDITION. MATLAB for Engineers. Third Edition. Holly Moore
INTERNATIONAL EDITION MATLAB for Engineers Third Edition Holly Moore 5.4 Three-Dimensional Plotting Figure 5.8 Simple mesh created with a single two-dimensional matrix. 5 5 Element,5 5 The code mesh(z)
More informationA General Introduction to Matlab
Master Degree Course in ELECTRONICS ENGINEERING http://www.dii.unimore.it/~lbiagiotti/systemscontroltheory.html A General Introduction to Matlab e-mail: luigi.biagiotti@unimore.it http://www.dii.unimore.it/~lbiagiotti
More informationCDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation
CDA6530: Performance Models of Computers and Networks Chapter 4: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationMatlab Tutorial for COMP24111 (includes exercise 1)
Matlab Tutorial for COMP24111 (includes exercise 1) 1 Exercises to be completed by end of lab There are a total of 11 exercises through this tutorial. By the end of the lab, you should have completed the
More informationIntroduction to Matlab
Introduction to Matlab Enrique Muñoz Ballester Dipartimento di Informatica via Bramante 65, 26013 Crema (CR), Italy enrique.munoz@unimi.it Contact Email: enrique.munoz@unimi.it Office: Room BT-43 Industrial,
More informationMATLAB Laboratory 09/23/10 Lecture. Chapters 5 and 9: Plotting
MATLAB Laboratory 09/23/10 Lecture Chapters 5 and 9: Plotting Lisa A. Oberbroeckling Loyola University Maryland loberbroeckling@loyola.edu L. Oberbroeckling (Loyola University) MATLAB 09/23/10 Lecture
More informationIntroduction to MATLAB
58:110 Computer-Aided Engineering Spring 2005 Introduction to MATLAB Department of Mechanical and industrial engineering January 2005 Topics Introduction Running MATLAB and MATLAB Environment Getting help
More informationWhat is MATLAB and howtostart it up?
MAT rix LABoratory What is MATLAB and howtostart it up? Object-oriented high-level interactive software package for scientific and engineering numerical computations Enables easy manipulation of matrix
More informationMATLAB Tutorial. Mohammad Motamed 1. August 28, generates a 3 3 matrix.
MATLAB Tutorial 1 1 Department of Mathematics and Statistics, The University of New Mexico, Albuquerque, NM 87131 August 28, 2016 Contents: 1. Scalars, Vectors, Matrices... 1 2. Built-in variables, functions,
More informationFundamentals of MATLAB Usage
수치해석기초 Fundamentals of MATLAB Usage 2008. 9 담당교수 : 주한규 joohan@snu.ac.kr, x9241, Rm 32-205 205 원자핵공학과 1 MATLAB Features MATLAB: Matrix Laboratory Process everything based on Matrix (array of numbers) Math
More informationMATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline
MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots
More informationPART 1 PROGRAMMING WITH MATHLAB
PART 1 PROGRAMMING WITH MATHLAB Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 23 September 2018 Programming with MATHLAB MATLAB Environment
More informationIntroduction to Engineering gii
25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.
More informationIntroduction to MATLAB programming: Fundamentals
Introduction to MATLAB programming: Fundamentals Shan He School for Computational Science University of Birmingham Module 06-23836: Computational Modelling with MATLAB Outline Outline of Topics Why MATLAB?
More informationIntroduction to MATLAB
ELG 3125 - Lab 1 Introduction to MATLAB TA: Chao Wang (cwang103@site.uottawa.ca) 2008 Fall ELG 3125 Signal and System Analysis P. 1 Do You Speak MATLAB? MATLAB - The Language of Technical Computing ELG
More informationCDA6530: Performance Models of Computers and Networks. Chapter 4: Using Matlab for Performance Analysis and Simulation
CDA6530: Performance Models of Computers and Networks Chapter 4: Using Matlab for Performance Analysis and Simulation Objective Learn a useful tool for mathematical analysis and simulation Interpreted
More informationGRAPHICS AND VISUALISATION WITH MATLAB
GRAPHICS AND VISUALISATION WITH MATLAB UNIVERSITY OF SHEFFIELD CiCS DEPARTMENT Des Ryan & Mike Griffiths September 2017 Topics 2D Graphics 3D Graphics Displaying Bit-Mapped Images Graphics with Matlab
More informationIntroduction to MATLAB. Todd Atkins
Introduction to MATLAB Todd Atkins tatkins@mathworks.com 1 MATLAB The Language for Technical Computing Key Features High-level language of technical computing Development environment for engineers, scientists
More informationChapters covered for the final
Chapters covered for the final Chapter 1 (About MATLAB) Chapter 2 (MATLAB environment) Chapter 3 (Built in Functions):3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.8, 3.9 Chapter 4 (Manipulating Arrays):4.1,4.2, 4.3
More informationPart V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017
Part V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017 Appendix A Glossary of Matlab Commands Mathematical Operations + Addition. Type help plus
More informationMATH 2221A Mathematics Laboratory II
MATH A Mathematics Laboratory II Lab Assignment 4 Name: Student ID.: In this assignment, you are asked to run MATLAB demos to see MATLAB at work. The color version of this assignment can be found in your
More information! The MATLAB language
E2.5 Signals & Systems Introduction to MATLAB! MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to -use environment. Typical
More informationSpring 2010 Instructor: Michele Merler.
Spring 2010 Instructor: Michele Merler http://www1.cs.columbia.edu/~mmerler/comsw3101-2.html MATLAB does not use explicit type initialization like other languages Just assign some value to a variable name,
More informationUNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER BENC 2113 DENC ECADD 2532 ECADD LAB SESSION 6/7 LAB
More informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationIntroduction to Matlab to Accompany Linear Algebra. Douglas Hundley Department of Mathematics and Statistics Whitman College
Introduction to Matlab to Accompany Linear Algebra Douglas Hundley Department of Mathematics and Statistics Whitman College August 27, 2018 2 Contents 1 Getting Started 5 1.1 Before We Begin........................................
More informationInlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS
Inlichtingenblad, matlab- en simulink handleiding en practicumopgaven IWS 1 6 3 Matlab 3.1 Fundamentals Matlab. The name Matlab stands for matrix laboratory. Main principle. Matlab works with rectangular
More informationMATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano
MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations
More informationLab #1 Revision to MATLAB
Lab #1 Revision to MATLAB Objectives In this lab we would have a revision to MATLAB, especially the basic commands you have dealt with in analog control. 1. What Is MATLAB? MATLAB is a high-performance
More informationSTAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006
STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics
More informationIntroduction to MATLAB Practical 1
Introduction to MATLAB Practical 1 Daniel Carrera November 2016 1 Introduction I believe that the best way to learn Matlab is hands on, and I tried to design this practical that way. I assume no prior
More informationInteractive Computing with Matlab. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Interactive Computing with Matlab Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu Starting Matlab Double click on the Matlab icon, or on unix systems
More informationPurpose of the lecture MATLAB MATLAB
Purpose of the lecture MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course This lecture contains a short introduction to the MATLAB For further details see other sources
More informationAn Introductory Tutorial on Matlab
1. Starting Matlab An Introductory Tutorial on Matlab We follow the default layout of Matlab. The Command Window is used to enter MATLAB functions at the command line prompt >>. The Command History Window
More informationIntroduction to Matlab
Introduction to Matlab Kristian Sandberg Department of Applied Mathematics University of Colorado Goal The goal with this worksheet is to give a brief introduction to the mathematical software Matlab.
More informationA very brief Matlab introduction
A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading
More informationAMS 27L LAB #2 Winter 2009
AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles
More informationScientific Functions Complex Numbers
CNBC Matlab Mini-Course Inf and NaN 3/0 returns Inf David S. Touretzky October 2017 Day 2: More Stuff 0/0 returns NaN 3+Inf Inf/Inf 1 -Inf, -NaN 4 Scientific Functions Complex Numbers Trig: Rounding: Modular:
More informationMath 375 Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau)
Natalia Vladimirova (many ideas, examples, and excersises are borrowed from Profs. Monika Nitsche, Richard Allen, and Stephen Lau) January 24, 2010 Starting Under windows Click on the Start menu button
More information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationComputer Programming in MATLAB
Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a
More informationIntroduction to Computer Programming with MATLAB Matlab Fundamentals. Selis Önel, PhD
Introduction to Computer Programming with MATLAB Matlab Fundamentals Selis Önel, PhD Today you will learn to create and execute simple programs in MATLAB the difference between constants, variables and
More informationTable of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7
MATLAB Table of Contents Introduction.*.. 7 About This Book 1 Foolish Assumptions 2 Icons Used in This Book 3 Beyond the Book 3 Where to Go from Here 4 Part /: Getting Started With MATLAB 5 Chapter 1:
More information50 Basic Examples for Matlab
50 Basic Examples for Matlab v. 2012.3 by HP Huang (typos corrected, 10/2/2012) Supplementary material for MAE384, 502, 578, 598 1 Ex. 1 Write your first Matlab program a = 3; b = 5; c = a+b 8 Part 1.
More informationLAB 1 General MATLAB Information 1
LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by
More informationMATLAB Guide to Fibonacci Numbers
MATLAB Guide to Fibonacci Numbers and the Golden Ratio A Simplified Approach Peter I. Kattan Petra Books www.petrabooks.com Peter I. Kattan, PhD Correspondence about this book may be sent to the author
More informationDr. Iyad Jafar. Adapted from the publisher slides
Computer Applications Lab Lab 6 Plotting Chapter 5 Sections 1,2,3,8 Dr. Iyad Jafar Adapted from the publisher slides Outline xy Plotting Functions Subplots Special Plot Types Three-Dimensional Plotting
More informationThe Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Chapter 7 Graphics Learning outcomes Label your plots Create different
More informationMatlab Lecture 1 - Introduction to MATLAB. Five Parts of Matlab. Entering Matrices (2) - Method 1:Direct entry. Entering Matrices (1) - Magic Square
Matlab Lecture 1 - Introduction to MATLAB Five Parts of Matlab MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse
More informationChemical Engineering 541
Chemical Engineering 541 Computer Aided Design Methods Matlab Tutorial 1 Overview 2 Matlab is a programming language suited to numerical analysis and problems involving vectors and matricies. Matlab =
More informationIntroduction to MATLAB
Introduction to MATLAB 1 Introduction to MATLAB A Tutorial for the Course Computational Intelligence http://www.igi.tugraz.at/lehre/ci Stefan Häusler Institute for Theoretical Computer Science Inffeldgasse
More informationLinear algebra & Numerical Analysis
Linear algebra & Numerical Analysis Introduction to MATLAB Marta Jarošová http://homel.vsb.cz/~dom033/ Outline What is it MATLAB? MATLAB Environment and MATLAB Help Variables, matrices and vectors Strings.m
More informationINTRODUCTION TO MATLAB
1 of 18 BEFORE YOU BEGIN PREREQUISITE LABS None EXPECTED KNOWLEDGE Algebra and fundamentals of linear algebra. EQUIPMENT None MATERIALS None OBJECTIVES INTRODUCTION TO MATLAB After completing this lab
More informationMATLAB Introduction to MATLAB Programming
MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed
More informationGeneral MATLAB Information 1
Introduction to MATLAB General MATLAB Information 1 Once you initiate the MATLAB software, you will see the MATLAB logo appear and then the MATLAB prompt >>. The prompt >> indicates that MATLAB is awaiting
More informationEvolutionary Algorithms. Workgroup 1
The workgroup sessions Evolutionary Algorithms Workgroup Workgroup 1 General The workgroups are given by: Hao Wang - h.wang@liacs.leideuniv.nl - Room 152 Furong Ye - f.ye@liacs.leidenuniv.nl Follow the
More informationObjectives. 1 Running, and Interface Layout. 2 Toolboxes, Documentation and Tutorials. 3 Basic Calculations. PS 12a Laboratory 1 Spring 2014
PS 12a Laboratory 1 Spring 2014 Objectives This session is a tutorial designed to a very quick overview of some of the numerical skills that you ll need to get started. Throughout the tutorial, the instructors
More informationECE 202 LAB 3 ADVANCED MATLAB
Version 1.2 1 of 13 BEFORE YOU BEGIN PREREQUISITE LABS ECE 201 Labs EXPECTED KNOWLEDGE ECE 202 LAB 3 ADVANCED MATLAB Understanding of the Laplace transform and transfer functions EQUIPMENT Intel PC with
More informationMATLAB Functions and Graphics
Functions and Graphics We continue our brief overview of by looking at some other areas: Functions: built-in and user defined Using M-files to store and execute statements and functions A brief overview
More information