Posts belonging to Category 'MATLAB'

Dynamics and Vibrations MATLAB tutorial

This tutorial is intended to provide a crash-course on using a small subset of the features of MATLAB. If you complete the whole of this tutorial, you will be able to use MATLAB to integrate equations of motion for dynamical systems, plot the results, and use MATLAB optimizers and solvers to make design decisions. You can work step-by-step through this tutorial, or if you prefer, you can brush up on topics from the list below. The tutorial contains more information than you (more…)

A MATLAB TUTORIAL FOR MULTIVARIATE ANALYSIS

These notes hopefully serve as an introduction to the wonderful world of Matlab. They cover the basics that are needed in order to carry out multivariate analysis (MVA) . Specifically they will give details of how to do and view the results of principal components analysis (PCA), discriminant function analysis (DFA) and hierarchical cluster analysis (HCA). If more in depth ‘programming’ is needed then please RTM. Whilst Matlab can do things like PLS, ANNs and some evolutionary programming you will need (more…)

Writing and calling functions

In this chapter we discuss how to structure a program with multiple source code files. First, an explanation of how code files work in MATLAB is presented. In compiled languages such as FORTRAN, C, or C++, code can be stored in one or more source files that are linked together to form a single executable at the time of compilation. MATLAB, being an interpreted language, deals with multiple source files in a more open-ended manner. MATLAB code is organized into ASCII files carrying (more…)

MATLAB Tutorial for Engineering Electromagnetics… and Beyond

This tutorial provides a brief introduction to the basics of using MATLAB, the MathWorks’ Corporation’s mathematical computation package. It was written to accompany Fundamentals of Electromagnetics with MATLAB, Second Edition by Lonngren, Savov, and Jost for students coming to the first engineering electromagnetics course with no or little prior exposure to MATLAB. Students who (more…)

MATLAB TUTORIAL FOR BEGINNERS

• WHY MATLAB? • MATLAB is relatively easy to learn • MATLAB code is optimized to be relatively quick when performing matrix operations • MATLAB may behave like a calculator or as a programming language • MATLAB is interpreted, errors are easier to fix. • WHAT MATLAB IS NOT. Limitations of MATLAB • MATLAB is NOT a general purpose programming language. • MATLAB is an interpreted (more…)

Matlab Programming

Preliminaries • Programs are contained in m-files  Plain text files – not binary files produced by word processors  File must have “.m” extension • m-file must be in the path  Matlab maintains its own internal path  The path is the list of directories that Matlab will search when looking for an m-file to execute.  A program can exist, and be free of errors, but it will not run if Matlab cannot find it.  Manually modify the path with the path, addpath, and rmpath built-in functions, or (more…)

MATLAB Tutorial

1. MATLAB Basics MATLAB is started by clicking the mouse on the appropriate icon and is ended by typing exit or by using the menu option. After each MATLAB command, the “return” or “enter” key must be depressed. A. Definition of Variables Variables are assigned numerical values by typing the expression directly, for example, typing a = 1+2 yields: a = 3 The answer will not be (more…)

An Introduction to Matlab Version 2.3

1 MATLAB  Matlab is an interactive system for doing numerical computations.  A numerical analyst called Cleve Moler wrote the rst version of Matlab in the 1970s. It has since evolved into a successful commercial software package.  Matlab relieves you of a lot of the mundane tasks associated with solving problems numerically. This allows you to spend more time thinking, and encourages you to experiment.  Matlab makes use of highly respected algorithms and hence you can be (more…)

Applied Econometrics using MATLAB

Preface This text describes a set of MATLAB functions that implement a host of econometric estimation methods. Toolboxes are the name given by the MathWorks to related sets of MATLAB functions aimed at solving a particular class of problems. Toolboxes of functions useful in signal processing, optimization, statistics, ¯nance and a host of other areas are available from the MathWorks as add-ons to the standard MATLAB software distribution. I use the term Econometrics (more…)

A Matlab Cheat-sheet (MIT 18.06, Fall 2007)

save ‘file.mat’ save variables to file.mat load ‘file.mat’ load variables from file.mat diary on record input/output to file diary diary off stop recording whos list all variables currenly defined clear delete/undefine all variables help command quick help on a given command doc command extensive help on a given command Defining/changing variables: x = 3 define variable x to be 3 x = [1 2 3] set x to the 1×3 row-vector (1,2,3) x = [1 2 3]; same, but don’t echo x to output x = [1;2;3] (more…)