| MATLAB | C++ |
|---|---|
| Interpretted | Compiled |
| Dynamically-typed | Statically-typed |
| Libraries are optimized, but user-defined code is not as efficient. | Can acheive better run-time efficiency. |
| Built-in support for multi-dimensional data sets and "vectorized" operations. | Library support for compound data structures, but no standard form for "vectorized" operations. |
| Built-in support for graphics/visualization | Third-party tools for graphics/visualization |
| topic | MATLAB | C++ |
|---|---|---|
| Function to approximate pi using Taylor series |
approxPiVectorized.m (vectorized technique)
approxPi.m (using for loop) |
approxPi.cpp |
| Function to compute surface area of a cylinder | cylinder.m | cylinder.cpp |
| Function to perform "coupon collecting" trials | collect.m | collect.cpp |
| Function to find monochromatic component of a two-dimensional array | findComponent1.m | findComponent.cpp |