Matlab_tutorial

Matlab_tutorial - Chemical Engineering 541 Computer Aided...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chemical Engineering 541 Computer Aided Design Methods Matlab Tutorial
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Overview Matlab is a programming language suited to numerical analysis and problems involving vectors and matricies. Matlab = Mat rix Lab oratory Many built in functions for solution of linear systems, interpolation, integration, solution of ODEs, etc. Straightforward syntax No need for external compilation/linking Built in 2D, 3D graphics, very flexible Can interface with C++, Java, Fortran Object oriented programming capabilities Graphical interface. Built-in debugging capability. Great for rapid programming/prototyping. Excellent learning environment, ideas carry over to faster, more flexible (and complex) languages, such as C, Fortran.
Image of page 2
3 FreeMat, Octave, Scilab Freemat, Octave, and SciLab are open source, Matlab-like variants Octave contains fewer features, but very similar syntax, and runs most Matlab scripts without modification. Visualization is via gnuplot Scilab has a Matlab-like look and feel. Freemat has a nice interface, and good plotting capabilities. www.gnu.org/software/octave , www.scilab.org , http://freemat.sourceforge.net
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Environment Command Window Editor Window History Variables
Image of page 4
5 Matlab Search Path File >> set path Organize files into one or more place as you create them. This goes for other environments/languages as well. Search path: EDU>> myvar 1. variable? 2. built-in function? 3. script file in current directory? 4. Matlab path? 5. Error
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Defining Variables, Expressions Expressions are saved to ans Variables are case sensitive: no spaces, start with a letter. Semicolon supresses output to screen Variables defined, use who, whos Special Vars: ans, beep, pi, eps, inf, NaN, i, j, nargin, nargout, realmin, realmax, bitmax, varargin, varargout Reserved Words for end if while function return elseif case otherwise switch continue else try catch global persistent break Operators: + - * / \ ^ Comments: EDU>> a=b+c; % this is a comment
Image of page 6
7 Vectors and Matricies Vectors, Matricies, Arrays are synonymous Enter elements between [ ... ] column elements separated by “,” or “ “
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern