Skip to content

Instantly share code, notes, and snippets.

@amroamroamro
amroamroamro / Readme.md
Last active August 29, 2015 14:08
[MATLAB] benchmark for parsing cell-array of strings
@amroamroamro
amroamroamro / README.markdown
Last active October 4, 2017 15:36
[MATLAB R2014b] MEX config files for Intel Parallel Studio XE 2015

XML configuration files for compiling MATLAB MEX-files using Intel Parallel Studio XE 2015. Tested on Windows 8.1 64-bit with MATLAB R2014b, Visual Studio 2013, and Intel Parallel Studio XE 2015.

Here is an example:

>>> mex -f intel_cpp_15_vs2013.xml -v -largeArrayDims test.cpp
>>> test()
@amroamroamro
amroamroamro / README.md
Last active August 29, 2015 14:10
[MATLAB] benchmark for growing arrays

Goal

Comparing performance of growing arrays in MATLAB with and without pre-allocation, in addition to expanding the size in batches.

Refer to [this Stack Overflow thread][1].

Tests

There are two version of the tests:

  • one that adds columns to a matrix
  • one that adds rows to a matrix
@amroamroamro
amroamroamro / README.md
Last active December 25, 2023 20:41
Fourier series animation

MATLAB code to demonstrate [Fourier series][1] representation of periodic signals (as a sum of sinusoidal functions).

The animation shows an approximation of a square wave signal using the first 4-terms of its Fourier series. (Change the parameters near the top of the code to manipulate the animations and explore other variations).

![animation1][6] ![animation2][7]

This was inspired by the following similar animations:

  • [Fourier Series Animation using Circles][2]
@amroamroamro
amroamroamro / README.md
Created February 1, 2015 19:52
[mexopencv] Epipolar Geometry example
@amroamroamro
amroamroamro / README.md
Last active January 12, 2024 22:12
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: https://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface

@amroamroamro
amroamroamro / README.md
Created April 10, 2015 18:01
[MATLAB] Comparison of array searching implementations

Comparison of different array searching implementation in MATLAB

http://stackoverflow.com/a/1913831/97160

Two benchmarks are included, one for searching a single value, another for searching multiple values (vectorized version).

You could also try different matrix sizes, as well as changing the search values (compare best case where all values are found in the array vs. worst case scenario when none of the values are found).

@amroamroamro
amroamroamro / README.md
Created July 22, 2015 17:45
[MATLAB] Example MEX-function with CUDA

Example of using CUDA in a MATLAB MEX-function.

Tested on Windows 8.1 x64, MATLAB R2015a, CUDA 6.5, Visual Studio 2013.

Steps to compile and test:

C:\> call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
C:\> set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5
C:\> set PATH=%PATH%;%CUDA_PATH%\bin;%CUDA_PATH%\lib;%CUDA_PATH%\lib64
@amroamroamro
amroamroamro / README.md
Created April 1, 2016 11:39
watershed: MATLAB vs. OpenCV
@amroamroamro
amroamroamro / README.md
Created November 22, 2016 11:48
[MATLAB] mex locking test

See #299.

Files:

MyClass.m
private/
    MyClass_.cpp

Compile the MEX-file as usual mex -largeArrayDims MyClass_.cpp (preferrably with C++11).