Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. Don’t use both the [matlab] and [octave] tags, unless the question is explicitly about the similarities or differences between the two. When using this tag, please mention the MATLAB release you're working with (e.g. R2017a).

MATLAB (Matrix Laboratory) is a high-level language and interactive programming environment for numerical computation and visualization, developed by MathWorks. MATLAB can be used when performing tasks such as signal processing and communications, image and video processing, computational finance, and computational biology. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend its core capabilities.

MATLAB is a cross-platform system developed since 1984. From the release of version 7.2 (R2006a) there has continued to be a biannual release cycle, with version "a" typically released in March/April and version "b" in September/October - based on the release history. For example R2017a and R2017b were the two releases in 2017.

MATLAB is a proprietary product of MathWorks. This means that, unlike open source languages, both programmers and users must own a valid software license in order to run MATLAB code.

There are several open source alternatives to MATLAB, in particular GNU Octave, which offers (mostly) bidirectional syntactic compatibility with MATLAB, Scilab, SciPy, and Julia.

Documentation

Informative links that show up quite often in answers##

  • Release notes for all versions.
  • MATLAB Central File Exchange: a repository of user-contributed MATLAB tools
  • MATLAB Add-Ons: Add-Ons for MATLAB
  • MATLAB Central blogs: usually updated weekly by a number of MathWorks employees
  • Undocumented MATLAB: "Charting MATLAB’s unsupported hidden underbelly"
  • MATLAB Answers: a collaborative environment for getting answers to questions about MathWorks products, similar to Stack Overflow
  • comp.soft-sys.matlab Usenet group: can be accessed online through Google Groups
  • MATLAB Cody™ is a place where you can go to find a variety of MATLAB-based coding challenges that will help to expand your understanding of MATLAB.
  • MATLAB ThingSpeak™ is an open data platform and API for the Internet of Things that enables you to collect, store, analyze, visualize, and act on data gathered directly from sensors or from other web sources. With ThingSpeak and its built-in MATLAB Analysis and MATLAB Visualizations apps, you can create custom trends and plots.
  • MATLAB Online: Online version of MATLAB (available to licensed users only). Octave Online is a free alternative based on the open source GNU Octave which is (pretty much) compatible with MATLAB.
  • MATLAB on Stack Overflow chat: Chat room for users of MATLAB and Octave
94593 questions
10
votes
3 answers

Matlab deployment: add files to source control?

I've created a deployment project which works rather well and now I want to add it to source control repository for others to use. The main problem I'm facing is that the .prj file which deploytool creates contains absolute paths which will not work…
shoosh
  • 76,898
  • 55
  • 205
  • 325
10
votes
4 answers

Get the location of a deployed Matlab application at runtime for Mac and Linux

I have some standalone Matlab programs that for different reasons need to access files in the directory they're located (either to launch another program or to read some XML files there). I have the following function that works for…
ackrause
  • 442
  • 5
  • 11
10
votes
2 answers

Performance of index creation

In trying to choose which indexing method to recommend, I tried to measeure the performance. However, the measurements confused me a lot. I ran this multiple times in different orders, but the measurements remain consistent. Here is how I measured…
Dennis Jaheruddin
  • 21,208
  • 8
  • 66
  • 122
10
votes
7 answers

How can I convert a color image to grayscale in MATLAB?

I am trying to implement an algorithm in computer vision and I want to try it on a set of pictures. The pictures are all in color, but I don't want to deal with that. I want to convert them to grayscale which is enough for testing the…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
10
votes
1 answer

Python NumPy log2 vs MATLAB

I'm a Python newbie coming from using MATLAB extensively. I was converting some code that uses log2 in MATLAB and I used the NumPy log2 function and got a different result than I was expecting for such a small number. I was surprised since the…
Hesse34
  • 101
  • 3
10
votes
4 answers

Periodogram in Octave/Matlab vs Scipy

I am porting some matlab code to python using scipy and got stuck with the following line: Matlab/Octave code [Pxx, f] = periodogram(x, [], 512, 5) Python code f, Pxx = signal.periodogram(x, 5, nfft=512) The problem is that I get different output…
mFoxRU
  • 500
  • 7
  • 17
10
votes
2 answers

How to get arrows on axes in MATLAB plot?

I want to plot something like this: x = 0:0.01:10; f = @(x) 50* 1.6.^(-x-5); g = @(x) 50* 1.6.^(+x-10); plot(x, f(x)); hold on plot(x, g(x)); I can't manage to get axes similar to the ones in this figure: I know I can remove the top and right…
Stewie Griffin
  • 14,889
  • 11
  • 39
  • 70
10
votes
1 answer

MATLAB: Self-Organizing Map (SOM) clustering

I'm trying to cluster some images depending on the angles between body parts. The features extracted from each image are: angle1 : torso - torso angle2 : torso - upper left arm .. angle10: torso - lower right foot Therefore the input data is a…
tguclu
  • 689
  • 3
  • 10
  • 25
10
votes
4 answers

How Do I Generate a 3-D Surface From Isolines?

I have a set of isoline points (or contour points) such as this: Each point on an isoline has its own respective X, Y, and Z coordinate. Since they are isolines, that means that each point will have a unique X-Y pair, but points on the same line…
Graviton
  • 81,782
  • 146
  • 424
  • 602
10
votes
3 answers

Fitting sigmoid to data

There are many curve fitting and interpolation tools like polyfit (or even this nice logfit toolbox I found here), but I can't seem to find anything that will fit a sigmoid function to my x-y data. Does such a tool exist or do I need to make my…
lollercoaster
  • 15,969
  • 35
  • 115
  • 173
10
votes
5 answers

Your experiences with Matlab/F#/R for data analysis and modeling algorithms

I've been using F# for a while now to model algorithms before coding them in C++, and also using it afterwards to check the results of the C++ code, and also against real-world recorded data. For the modeling side of things, it's very handy, but for…
Benjol
  • 63,995
  • 54
  • 186
  • 268
10
votes
2 answers

Reading date and time from CSV file in MATLAB

datetime, M01, M02, M03, M04, M05, M06 8/15/2009 0:00, 5.8, 7.8, 7.8, 7.3, 0, 7.9 8/15/2009 0:10, 7.1, 8.1, 8.1, 7.7, 0, 8.1 8/15/2009 0:20, 6.8, 7.4, 7.6, 7.1, 0, 7.3 8/15/2009 0:30, 5.6, 6.8, 7.1, 6.6, 0, 6.8 8/15/2009 0:40, 3.9, 6.2, 6.4, 6.2, 0,…
AP.
  • 750
  • 3
  • 12
  • 19
10
votes
1 answer

how to remove the gap between subplots and around

I am plotting two subplots (2x1) in one figure. I would like to remove all the spacing between two subplots and remove the xlable and xlabel ticks for the top subplot too. Also, I am trying to remove all the spacing outside the subplot. I try…
user1285419
  • 2,183
  • 7
  • 48
  • 70
10
votes
2 answers

Convert MATLAB char array to string

Starting with the MATLAB char array, A: A(1,1) = 'A' A(1,2) = 'P' A(1,3) = 'R' A(2,1) = 'M' A(2,2) = 'A' A(2,3) = 'Y' How can this be converted to a cell of strings, B, such that: B{1} = 'APR' B{2} = 'MAY' Edit: A is a cell and using the function…
rwolst
  • 12,904
  • 16
  • 54
  • 75
10
votes
2 answers

Eigen boolean array slicing

In MATLAB it is common to slice out values that satisfy some condition from a matrix/array (called logical indexing). vec = [1 2 3 4 5]; condition = vec > 3; vec(condition) = 3; How do I do this in Eigen? So far I have: Eigen::Matrix
ejang
  • 3,982
  • 8
  • 44
  • 70