Posts Tagged ‘Examples’
Using the Editor and Debugger with Classes
Referring to Class Files
Define classes in M-files just like scripts and functions. To use the editor or debugger with a class file, use the full class name. For example, suppose the file for a class, myclass.m is in the following location: Read More
Example of Class Definition Syntax
Example of Class Definition Syntax
The following code shows the syntax of a typical class definition. This example is not a functioning class because it references functions that it does not implement. The purpose of this section is to illustrate various syntactic constructions. Read More
Adding Text Annotations to Graphs
What Are Text Annotations?
Text annotations are boxes containing text strings that you compose. The box can have a border and a background, or be invisible. The text can be in any installed text font, and can include TeX or LaTeX markup. You can add free-form text annotations anywhere in a MATLAB figure to help explain your data or bring attention to specific points in your data sets. Read More
Tags: and TEX Characters, BackgroundColor, EdgeColor, Examples, Expression, Extent, find, get, graph, Greek Letters, gtext, HorizontalAlignment, Interpreter, Latex, LineStyle, LineWidth, Margin, Mathematical, Mathematical Expression, Mathematical Symbols, matlab, num2str, plotedit, Position, Positioning Annotations in Data Space, string, Support, Symbols, table of available TEX, text, Text Alignment, Text in Cell Arrays, title, uicontrol, VerticalAlignment, xlabel, ylabel, zlabel
MATLAB Commands
Basic Command Syntax
A simple MATLAB command computes the result of the expression to the right of the equals sign and assigns the value of the result to the output variable at the left. Examples of simple MATLAB commands are Read More
Finding maximum and minimum values in arrays
Let’s write a function file range.m that calculates the difference between the maximum and minimum value in a vector. The file should return a reply. Open an edit window. Create a function file like the one below. Read More
Analysis of Functions, Interpolation, Curve Fitting, Integrals and Differential Equations 2
Localize minima and maxima of functions
Let us try to find the local minima and maxima for the function func(x). The interval of interest is [-6 0]. The algorithms are iterative. There are 2 methods to use. The first one decides x in a given interval, and the second one looks for x around an initial guess. To decide the maxima we are looking for an x that minimizes the negative function: -func(x). Read More
Tags: Analysis of Functions, applications, Command Window, curve, Define, differential, end, equations, Examples, fitting, for, format, full, Functions, grid, help, hold, if, inf, info, integral, integrals, integrand, interpolation, legend, load, matlab, mesh, meshgrid, minus, plot, polynomial, rand, randn, rem, round, sign, sum, title, tutorials, ver, what
bsxfun
bsxfun – Apply element-by-element binary operation to two arrays with singleton expansion enabled
Syntax Read More