Browsed by
Category: Matlab

Anonymous Functions in Matlab

Anonymous Functions in Matlab

There is a way to create a one-line expression-based MATLAB function that does not require a program file. It is called an anonymous function. The following very simple example shows how it works. It is very useful when you want to calculate the values without storing them to a variable (vector, or matrix) while keeping the code simple (without creating another program file).

Export Matlab plots for presentations and publications

Export Matlab plots for presentations and publications

When it comes to presentations and report/paper writing (either in Word/Powerpoint or in LaTeX/Beamer), the question of how to generate good looking Matlab figures is very often neglected by many students but unfortunately also by many researchers and academics. In this short post I show how I’m used to export my graphs. To take a simple example, the following Matlab script generates a graph with two impedance curves of an electrodynamic loudspeaker for two different mechanical stiffnesses $K_{ms}$. The most…

Read More Read More

How to put several 2D lines in a 3D grayscale plot

How to put several 2D lines in a 3D grayscale plot

It is sometimes convenient to display several 2D curves on one 3D graph and choose gray-scale colors so that the printed version of the figure is readable. The following Matlab code (an example of a loudspeaker’s low-frequencies pressure outputs for different quality factors $Q_{ts}$) shows how to do it.