Introduction To MATLAB

3y ago
24 Views
5 Downloads
521.56 KB
33 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Genevieve Webb
Transcription

Introduction to MATLABArturo Donate

IntroductionWhat is MATLAB?ToolboxesEnvironmentComparisonMATLAB BasicsConclusionProgramming

What is MATLAB?Matrix laboratoryprogramming environmenthigh-performance languageWindows, OSX, Linux/UNIXMatrix/Vector computationslinear equations, eigenvectors, etc.LINPACK, EISPACK, LAPACK, BLAS, etc.

What is MATLAB?Uses:math & computationalgorithm developmentmodeling and simulationdata analysis and visualizationapplication development

What is MATLAB?Toolboxesimage processingfiltering, transforms, analysis, enhancementstatisticslinear models, probability dist., HMMsoptimizationmax/minimization, least squares, line fitting

What is MATLAB?Toolboxesfixed-pointfixed-point data type & arithmeticothers:symbolic mathsignal processingvirtual reality

Environment

Environment

Basic Console Commandshelpevallsdispwho, whoswhat, typeclear, packlookfor, whichload, saveexit, quit

Basic Math CommandsOperationsConstantsmean, median, modepi 3.14159.sum, absi, j sqrt(-1)sin, sinh, asin, etc.realmin, realmaxsqrt, log, expInf, NaNfloor, ceil, roundhist, plot

Vectors and MatricesCreatingM ones(10,10)zeros, rand, randn,eye, magic)M [1 2 3; 4 5 6; 7 89]M(1,1) 23M [eye(6) rand(6)]AccessingM(x, y)M(x, :), M(x, i:j)DeletingM []

Vectors and MatricesOperations -*/ ‘eigany, allsvddiagtracerankprod

Vectors and MatricesSample expressions:A B*Cdeterm det(C)num abs(3 4i)index find(C 0)vector sin(1:50)x isprime(y)B [A’ C’]num numel(x)B(:,2) [][x y] size(C)

Vectors and MatricesColon notation1 : 50A(1:3, 2)1 : 2 : 50A(2:4, :)A(:, 2)sin(0 : pi/20 : 2*pi)

Graphics2D Example: plot( sin( 0 : pi/20 : 2*pi ) )

Graphics3D example - plot 3D point cloud

Graphics

ProgrammingFunctionsfunction [X Y] func name(arg1,arg2)func name.mprimary vs subfunctionsnested functiondeclaration/definitionprivate functionsfunction overloading(int vs double)global variablespre-allocationvectorization

Programmingscript vs functionif, elseif, elsefor, whileswitch, casecontinue, breakreturn

ProgrammingRelations aa ba ba aa ba ba&b

ProgrammingData StructuresMatrixbasic data typeCellmulti-dimensionalmatricesStringcharacter arrayStructuretype with variousfields

Simple Example: SVDCreate a function that:takes a matrix as inputmake sure the matrix is squarecomputes the SVD decompositionreturns the first singular value“answer my func(matrix)”

Simple Example: SortCreate a function that:takes a list as inputsorts the listreturns a list with sorted values“answer my func(matrix)”

Image ProcessingToolbox used for image processing, computervision, and signal processing tasksimage transformationregistrationfilteringimage analysis/enhancement/de-blurringsegmentationetc.

Image ProcessingNoise reduction examplesalt & pepper noisemean, median filterfilter2( fspecial(‘average’, 3), image) / 255medfilt2(image, [3 3])

Image ProcessingColor segmentation examplecform makecform(‘srgb2lab’)lab img applycform(image, cform)ab double(lab img(:,:,2:3))nrows size(ab, 1)ncols size(ab, 2)ab reshape(ab, nrows*ncols, 2)

Image Processing[cluster idx, cluster center] kmeans(ab, 3,‘distance’, ‘sqEuclidean’, ‘Replicates’, 3);label reshape(cluster idx, nrows, ncols, 1);

Image ProcessingTexture segmentation exampleE entropyfilt(I);Eim mat2gray(E);BW1 im2bw(Eim, 0.8);BWao bwareaopen(BW1, 2000);nhood true(9);

Image ProcessingcloseBWao imclose(BWao, nhood);roughmask imfill(closeBWao, ‘holes’);I2 I; I3 I;I2(roughmask) 0;I3( roughmask) 0;

MATLAB ClonesPackages: Scilab, Octave, RlabSimilar:matrix is basic data typecomplex number supportbuilt-in mathematical functionspowerful libraryuser-defined functions

MATLAB ClonesScilabwww.scilab.orgbest support & docsgood -likemost compatibleRlabrlab.sourceforge.netattempts to improvesyntax/semanticsleast compatible

Conclusionsinteractive programming environmenthigh performance languagealgorithm designmodeling & simulationanalysis & visualizationlinear algebratoolboxes

ReferencesMATLAB:www.mathworks.comMATLAB LAB Comparison:www.dspguru.com/sw/opendsp/mathclo2.htm

What is MATLAB? Uses: math & computation algorithm development modeling and simulation data analysis and visualization application development

Related Documents:

MATLAB tutorial . School of Engineering . Brown University . To prepare for HW1, do sections 1-11.6 – you can do the rest later as needed . 1. What is MATLAB 2. Starting MATLAB 3. Basic MATLAB windows 4. Using the MATLAB command window 5. MATLAB help 6. MATLAB ‘Live Scripts’ (for algebra, plotting, calculus, and solving differential .

19 MATLAB Excel Add-in Hadoop MATLAB Compiler Standalone Application MATLAB deployment targets MATLAB Compiler enables sharing MATLAB programs without integration programming MATLAB Compiler SDK provides implementation and platform flexibility for software developers MATLAB Production Server provides the most efficient development path for secure and scalable web and enterprise applications

MATLAB tutorial . School of Engineering . Brown University . To prepare for HW1, do sections 1-11.6 – you can do the rest later as needed . 1. What is MATLAB 2. Starting MATLAB 3. Basic MATLAB windows 4. Using the MATLAB command window 5. MATLAB help 6. MATLAB ‘Live Scripts’ (for

3. MATLAB script files 4. MATLAB arrays 5. MATLAB two‐dimensional and three‐dimensional plots 6. MATLAB used‐defined functions I 7. MATLAB relational operators, conditional statements, and selection structures I 8. MATLAB relational operators, conditional statements, and selection structures II 9. MATLAB loops 10. Summary

I. Introduction to Programming Using MATLAB Chapter 1: Introduction to MATLAB 1.1 Getting into MATLAB 1.2 The MATLAB Desktop Environment 1.3 Variables and Assignment Statements 1.4 Expressions 1.5 Characters and Encoding 1.6 Vectors and Matrices Chapter 2: Introduction to MATLAB Programming 2.1 Algorithms 2.2 MATLAB Scripts 2.3 Input and Output

foundation of basic MATLAB applications in engineering problem solving, the book provides opportunities to explore advanced topics in application of MATLAB as a tool. An introduction to MATLAB basics is presented in Chapter 1. Chapter 1 also presents MATLAB commands. MATLAB is considered as the software of choice. MATLAB can be used .

Compiler MATLAB Production Server Standalone Application MATLAB Compiler SDK Apps Files Custom Toolbox Python With MATLAB Users With People Who Do Not Have MATLAB.lib/.dll .exe . Pricing Risk Analytics Portfolio Optimization MATLAB Production Server MATLAB CompilerSDK Web Application

Lecture 14: MATLAB I “Official” Supported Version in CS4: MATLAB 2018a How to start using MATLAB: CS Dept. Machines - run ‘cs4_matlab’ Total Academic Handout (TAH) Local Install - software.brown.edu MATLAB Online (currently 2019a) - matlab.mathworks.com Navigating the Workspace (command window, variables, etc.) Data types in MATLAB (everything is a 64-bit .