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
4 answers

Do I conserve memory in MATLAB by declaring variables global instead of passing them as arguments?

I am new to MATLAB, it wasn't in the job description and I've been forced to take over for the person who wrote and maintained the code my company uses. Life's tough. The guy from which I'm taking over told me that he declared all the big data…
Shalom Craimer
  • 20,659
  • 8
  • 70
  • 106
10
votes
4 answers

Large numbers multiplication in MATLAB

I have a question out of sheer curiosity. How is multiplication of large numbers implemented in MATLAB ? Is it Karatsuba,Toom-3, Fürer or something entirely different ?
slezadav
  • 6,104
  • 7
  • 40
  • 61
10
votes
3 answers

Fitting a line that passes through the origin (0,0) to data

I have a set of points (x,y) and I need to find the line of best-fit that passes through the origin using MATLAB.
dr_rk
  • 4,395
  • 13
  • 48
  • 74
10
votes
2 answers

Integrate indentation & content changes in Git during merge: Best practices?

I'm using Git to track some matlab code. A toy example best illustrates the problem. The project so far looks like this. C / A-- \ B Contents of A are x=5 We make commit C, where the line is changed to x=6 We then make commit B, where…
Daniel Kessler
  • 1,172
  • 17
  • 21
10
votes
5 answers

Does Python have a linspace function in its std lib?

Does Python have a function like matlab's linspace in its standard library? If not, is there an easy way to implement it without installing an external package? Here's a quick and easy definition of linspace in matlab terms. Note I don't need a…
mjgpy3
  • 8,597
  • 5
  • 30
  • 51
10
votes
2 answers

matlab command (from bash / command line) on an already running session

$ matlab -nodesktop -nojvm & How would I execute matlab commands on the session that was just created? In other words, I want to have a matlab session running in the background, and execute matlab commands and/or scripts from an arbitrary terminal…
kDawson
  • 115
  • 1
  • 5
10
votes
3 answers

Is there a function in Matlab similar to the java function String.split(delimiter)?

Is there a (default) Matlab function that behaves similar to the java method split(delimiter), where you can tokenize a string based on an arbritary delimiter?
robguinness
  • 16,266
  • 14
  • 55
  • 65
10
votes
4 answers

How to check if four points form a rectangle

I am working on a shape recognition app. At this moment a set of points (x,y) is determined by corner detector (red points, img. 2.). Four of these points (in red frames, img. 2.) are vertices of a rectangle (sometimes a little deformed rectangle).…
sowizz
  • 175
  • 3
  • 11
10
votes
2 answers

Need to fit polynomial using chebyshev polynomial basis

I have been fitting linear least-squares polynomials to data using the polyfit function in matlab. From what I read, this uses standard polynomial basis (monomial basis). I have read that using Chebyshev polynomial basis to fit leads to greater…
user1593853
  • 127
  • 1
  • 1
  • 7
10
votes
6 answers

Hue to wavelength mapping

Is there an algorithm to find out the wavelength of the color given the hue value (between 0 degree to 360 degree). Is there any built-in function in MATLABfor the same?
SegFault
  • 1,024
  • 2
  • 16
  • 25
10
votes
3 answers

Converting a .mat file from MATLAB into cv::Mat matrix in OpenCV

I have some MATLAB code that I want to migrate to OpenCV. The data that the MATLAB code uses is stored in a .mat file which is then loaded at run time. I converted this .mat file into a .csv file and am then reading this data into OpenCV as a…
Sid
  • 231
  • 1
  • 4
  • 15
10
votes
3 answers

Linear Algebra Library for Sparse Matrices

I am interested in porting my Matlab implementation to C++ for speed improvement. I tried armadillo. It is perfect for porting code from Matlab because Armadillo's library functions names/syntax is very close to that of Matlab programming. However I…
Haider
  • 938
  • 2
  • 11
  • 25
10
votes
4 answers

How should I normalize a vector in Matlab where the sum is 1?

I need to normalize a vector of N integers so that: Each value is proportional to its original value (the value will be between 0 and 1) The sum of all values is =1 For instance: If I have a vector V = [2,2,1,0] the normalized vector should…
dragonmnl
  • 14,578
  • 33
  • 84
  • 129
10
votes
3 answers

precision differences in matlab and c++

I am trying to make equivalence tests on an algorithm written in C++ and in Matlab. The algorithm contains some kind of a loop in time and runs more than 1000 times. It has arithmetic operations and some math functions. I feed the initial inputs to…
crbah
  • 338
  • 4
  • 12
10
votes
4 answers

Object Tracking: MATLAB vs. Python Numpy

I will soon be starting a final year Engineering project, consisting of the real-time tracking of objects moving on a 2D-surface. The objects will be registered by my algorithm using feature extraction. I am trying to do some research to decide…
hjweide
  • 11,893
  • 9
  • 45
  • 49