Matlab examples - the blog...

Here are some new examples and applications that I have added to my website. They try to clarify the use of some instructions and functions in Matlab. I hope you find them useful...

Create Matlab GUI - video

Video demonstration of how a Matlab GUI is created, drag-and-drop capabilities, and callback functions introduction...

Continue reading "Create Matlab GUI - video"

Power Factor Correction Capacitors

Example of the formulas to calculate power factor correction capacitors. These diagrams show the relationship of...

Continue reading "Power Factor Correction Capacitors"

Card Trick with Matlab GUI

In this article we’re going to develop another computerized card trick using callback-functions in Matlab GUIs. I strongly suggest you read the first and second articles in this series, to know how to start and how to use the very important three instructions ‘get’, ‘set’ and ‘guidata’...

Continue reading "Card Trick with Matlab GUI"

WinSpice Simulator and Matlab

WinSpice Simulator driven from Matlab. In this article, a Matlab routine to drive the WinSPICE simulator is presented. This method can be easily adapted to simulate any circuit entered in a fully parameterized manner. The performance of the Matlab driver is illustrated by simulating a simple amplifier...

Continue reading "WinSpice Simulator and Matlab"

Fourier Analysis - introduction from a practical point of view

Fourier analysis has many applications in science, physics, digital signal processing, imaging, numerical analysis, acoustics... Let's use math software to...

Continue reading "Fourier Analysis - introduction from a practical point of view"

Line detection - working images with Matlab...

This experiment explores line detection (image analysis) with Matlab...

Continue reading "Line detection - working images with Matlab..."

Magic Square - properties in Matlab

Would you like to form a magic square with Matlab? Would you like to know why it is magic? Would you like to learn Matlab?...

Continue reading "Magic Square - properties in Matlab"

3D Plot Part 2 - working with Matlab

The 3D plot functions intended for plotting meshes and surfaces 'mesh' and 'surf', and their several variants 'meshc', 'meshz', 'surfc', and 'surfl', take multiple optional input arguments, the most simple form being 'mesh(z)' or 'surf(z)', where z represents a matrix. See these examples...

Continue reading "3D Plot Part 2 - working with Matlab"

Polynomials in Matlab

Polynomials are used so commonly in algebra, geometry and math in general that Matlab has special commands to deal with them. The polynomial 2x4 + 3x3 − 10x2 − 11x + 22 is represented in Matlab by the array [2, 3, -10, -11, 22] (coefficients...

Continue reading "Polynomials in Matlab"

Polynomial Regression in Matlab - easy least squares fitting

We'll demonstrate how to work out polynomial regression in Matlab (also known as polynomial least squares fittings)...

Continue reading "Polynomial Regression in Matlab - easy least squares fitting"

Periodic Function - some codes without special toolboxes in Matlab

A periodic function repeats its values in regular periods or intervals. We explore codes for square and sawtooth waves without any special toolbox needed...

Continue reading "Periodic Function - some codes without special toolboxes in Matlab"

Calculating BMI - another GUI in Matlab

In this project, we are going to develop a GUI in Matlab to calculate the BMI (body mass index). We are going to introduce the radio button...

Continue reading "Calculating BMI - another GUI in Matlab"

Numerical Gradient - code in Matlab

We are going to include the concepts in our Derivative function created before, to develop a Matlab function to calculate the gradient of a multidimensional scalar function. The function is going to have the following functionality...

Continue reading "Numerical Gradient - code in Matlab"

Polygon Area - calculate with Matlab

This program calculates a polygon area, using Matlab. You must supply the x and y coordinates of all vertices. Coordinates must be entered in order of successive vertices...

Continue reading "Polygon Area - calculate with Matlab"

T statistic - Student's t-distribution Test in Matlab

This algorithm performs the t statistic and degrees of freedom for Student’s distribution, in Matlab code. The calculations can be based on any one of these three hypotheses...

Continue reading "T statistic - Student's t-distribution Test in Matlab"

Permutations and Combinations - calculate its number in Matlab

This algorithm (code in Matlab) calculates the number of permutations and combinations of N objects taken D at a time. The full Matlab code is...

Continue reading "Permutations and Combinations - calculate its number in Matlab"

Scilab 3D Plot

Create your first Scilab 3D Plot with these functions. See about plot3d, meshgrid and others...

Continue reading "Scilab 3D Plot"

Calculate Square Feet - online spreadsheet

How to calculate square feet - see this online converter for feet and inches...

Continue reading "Calculate Square Feet - online spreadsheet"

Callback Function - GUIs in Matlab

In this article we’re going to build-up a simple adder. Our adder (by means of relevant callback function s) is going to have two ‘edit text’ components, two ‘static text’ components, and one ‘push button’ element.

Continue reading "Callback Function - GUIs in Matlab"

Matlab Plot - using stems (vertical lines) for discrete functions

In this example, we study the Matlab plot 'stem' instruction to illustrate functions. It draws vertical lines (with little circles on the tip) proportional to the value of the function at that horizontal value...

Continue reading "Matlab Plot - using stems (vertical lines) for discrete functions"