Differentiation and Integration in Matlab

Symbolic expressions can allow for the evaluation of equations as shown in a previous post on symbolics. Symbolics can further be used to solve equations that vary with time or with respect to one another. Calculating this change, either as a derivative or integral, can be done implicitly using the functions ‘sym’,'diff’, and ‘int’.
Continue reading

Bookmark and Share

Symbolic expressions and solving linear equations in Matlab

While Matlab is known for its capabilities in solving computationally intensive problems, it is also very useful in handling symbolic expressions, and further solving simple algebraic equations. In this tutorial we will investigate how to represent symbolic variables using the functions ‘sym’ and ‘syms’, solve equations using ‘solve’, and plot solutions to these symbolic expressions. Continue reading

Bookmark and Share

Computation using cellfun

Cell arrays are useful means of holding various types and sizes of information (as are structs). When manipulations or computations need to be performed on all or a subset of values in a cell array, one useful function that can be utilized is cellfun . Similar to other functions such as structfun or arrayfun, cellfun allows you to apply a predefined or user defined function to each element in the array.

Continue reading

Bookmark and Share

The use of findobj and set for graphics properties

After you create a plot in Matlab, you might need to modify the characteristics of the figure. While many options can be specified during the initial plot command, they can easily be modified later as well using plot handles, and the useful functions of ‘findobj’,'get’ and ‘set’. If you are unclear on some of these commands, or need a refreshers, take a look at our tutorial on plotting .

Continue reading

Bookmark and Share

Getting user input in MATLAB – the use of input, ginput and inputdlg

Sorry for the delay in postings, but many of us are in the state of transition, whether its school, weddings or work. As a simple tutorial to get back into the swing of things, let’s look at several different ways of requesting user input in your MATLAB programs. While you will often need to display information to the user, you will have to request data from them as well. There are several options available to you, and we will run through many of them here. The most basic of which is the command line based “input”.

Continue reading

Bookmark and Share