How-To: Create custom surface models from scattered MATLAB data

Those wishing to model a surface from data in the form of z(x,y) from scattered or  semi-scattered data have had few options in matlab – mainly griddata.

Griddata is a valuable tool for interpolation of scattered data. However it fails when there are replicates or when the data has many collinear points. Griddata is also unable to extrapolate beyond the convex hull of the data unless the ‘v4’ option is used, which is slow.

Gridfit solves all of these problems, although it is not an interpolant. It builds a surface over a complete lattice, extrapolating smoothly into the corners. You have control of the amount of smoothing done, as well as interpolation methods, which solver to use, etc.

Surface Fitting using gridfit


Matlab: Rubik’s Cube Simulator and Solver

Get files and more info from here (free mathworks account is required).

This program allows you to generate a randomly scramble cube of arbitrary dimension which can then be manipulated manually or solved by the computer. You can also input your own state using a webcam (3x3x3), or simply enter the colors of each facelet (2,3,4x.x.).

There are several built-in solving mechanisms available:
– God’s Algorithm for the 2x2x2: this is the optimal solution for the given state (in half-turn metric).
– Thistlethwaite 45 (T45) for the 3x3x3: this algorithm will always find a solution of 45 moves or less, averaging at 31.
– Layer-by-Layer (Beginners’) Solution: this is the method commonly used by beginners to solve the cube. More intuitive than T45, but also more extensive and less effective.
– 423T45 for the 4x4x4 (read 4 to 3, T45): this algorithm brings the cube to a state which can be handled like it was a 3x3x3 cube. When this is achieved, T45 can be applied to solve it (~180 moves on avg).
– Inverse Scramble for all cubes: it is like cheating, but when the scramble is known, each cube can be solved by inversing the sequence.

All of the above methods (with exception of the inverse scramble, which is trivial) are explained extensively in the included PDF. The PDF also contains a vast theoretical description of the cube.


Matlab: Face Detection and Tracking Using CAMShift

Object detection and tracking are important in many computer vision applications including activity recognition, automotive safety, and surveillance. In this example, you will develop a simple face tracking system by dividing the tracking problem into three separate problems:

  1. Detect a face to track
  2. Identify facial features to track
  3. Track the face.

 

View the code here!


Matlab: Image Segmentation Tutorial (“BlobsDemo”)

Get files from here (free mathworks account is required).

Perfect for the beginner, this demo illustrates simple object detection (segmentation, feature extraction), measurement, and filtering. Requires the Image Processing Toolbox (IPT) because it demonstrates some functions supplied by that toolbox, plus it uses the “coins” demo image supplied with that toolbox. If you have the IPT (you can check by typing ver on the command line), you should be able to run this demo code simply by copying and pasting this code into a new editor window, and then clicking the green “run” triangle on the toolbar.

First finds all the objects, then filters results to pick out objects of certain sizes. The basic concepts of thresholding, labeling, and regionprops are demonstrated with a simple example.

It’s a good tutorial for those users new to MATLAB’s image processing capabilities to learn on, before they go on to more sophisticated algorithms.


Matlab: Customizable Heat Maps

Get files from here (free mathworks account is required).

HEATMAP displays a matrix as an image whose color intensities reflect the magnitude of its values. In addition, it enables you to specify the following properties:

* X- and Y-axes tick labels:
Display the row/column indices or any other numeric or text labels. X-axis tick labels can even be rotated.

* Text labels:
Overlay the heatmap image with formatted text labels. The text labels can be derived from the original numeric matrix or a different matrix or cell array for displaying another dimension of data. You can control the font size and font color of the labels. The labels update automatically with zooming, panning or resizing the figure.

* Custom color maps:
Use MATLAB’s default color maps or specify your own. The function provides two additional color maps – “money” (shown in the example image) and “red” (a color map of red color intensities). Specify Linear or Logarithmic color maps and the number of color levels. You can even use different color maps for different heat maps within a figure.

* Other configurable parameters such as grid lines, color bars.

NOTE: If using rotated tick labels, HEATMAP will resize the axes to make room for the tick labels. When overwriting existing heatmap plots with a new heatmap, use CLF to first clear the figure. See heatmap_examples for an illustration.


Matlab: 41 Complete GUI Examples

Get files from here (free mathworks account is required).

This is a collection of GUIs meant to serve either to answer specific questions about writing GUIs or as a teaching tool to aid in learning how to write MATLAB GUIs without GUIDE. Many of these are inspired directly from the newsgroup.

The questions/files are written in approximate order of complexity, so intermediate users may want to skip the first several files.

The questions answered include: Συνεχίστε την ανάγνωση του “Matlab: 41 Complete GUI Examples”


Άνοιγμα μενού
Αλλαγή μεγέθους γραμματοσειράς
Αντίθεση