Questions tagged [octave]

GNU Octave is a free and open-source mathematical software package and scripting language. The scripting language is intended to be compatible with MATLAB, but the two packages are not interchangeable. Don’t use both the [matlab] and [octave] tags, unless the question is explicitly about the similarities or differences between the two.

GNU Octave is a high-level interpreted scripting language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave has a modular framework that allows it to utilize hardware such as GPUs, parallel compute clusters, and physical sensors.

Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. It is quite similar to Matlab, so many programs are easily portable.

It is extensible and customizable via user-defined functions written in Octave's own language, or via dynamically loaded modules written in C++, C, Fortran, or other languages.

Octave Online is a free GNU Octave editor and prompt in your browser. Octave Online is powered by the open-source GNU Octave project, whose syntax is mostly compatible with Matlab.

###Resources

5227 questions
52
votes
2 answers

Is the Julia language really as fast as it claims?

Following this post I decided to benchmark Julia against GNU Octave and the results were inconsistent with the speed-ups illustrated in julialang.org. I compiled both Julia and GNU Octave with CXXFLAGS='-std=c++11 -O3', the results I got: GNU…
juliohm
  • 3,691
  • 2
  • 18
  • 22
52
votes
4 answers

.m files as MATLAB/Octave for Sublime Text

Sublime sees .m files as Objective C files. I've been given a bunch of MATLAB/Octave files to work with using Octave, all with .m extensions. If I change the extensions to .matlab, then Sublime will recognize them and format them correctly, but…
scharfmn
  • 3,561
  • 7
  • 38
  • 53
49
votes
4 answers

GNU Octave method to operate on each item in a matrix. octave "arrayfun(...)" example

In GNU Octave version 3.4.3, I am having trouble applying a custom function to operate on each item/element in a matrix. I have a (2,3) matrix that looks like: mymatrix = [1,2,3;4,5,6]; mymatrix 1 2 3 4 5 6 I want to use each…
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
46
votes
3 answers

How to clear the command line in Octave?

In Octave, when typing command in the command line, sometimes I need to erase the whole line and restart a new command. In Matlab, erasing the text would be done with the ESC key. In Octave this does not work. The only way I found to discard the…
ysap
  • 7,723
  • 7
  • 59
  • 122
46
votes
7 answers

Gradient Descent implementation in octave

I've actually been struggling against this for like 2 months now. What is it that makes these different? hypotheses= X * theta temp=(hypotheses-y)' temp=X(:,1) * temp temp=temp * (1 / m) temp=temp * alpha theta(1)=theta(1)-temp hypotheses= X *…
narthur157
  • 864
  • 1
  • 8
  • 17
45
votes
2 answers

How can I sort a 2-D array in MATLAB with respect to one column?

I would like to sort a matrix according to a particular column. There is a sort function, but it sorts all columns independently. For example, if my matrix data is: 1 3 5 7 -1 4 Then the desired output (sorting by the first column)…
Midhat
  • 17,454
  • 22
  • 87
  • 114
44
votes
2 answers

Why is Octave slower than MATLAB?

I have been using Octave and MATLAB for a few projects, and I've come across a few questions. This question Why/when should I prefer MATLAB over Octave?) answered several, but there is still one lingering... I've read a number of posts/other sources…
Sam Grondahl
  • 2,397
  • 2
  • 20
  • 26
42
votes
2 answers

suppressing printing every assignment

I have written a simple script in Octave. When I run it from the command line, Octave prints a line every time a variable gets assigned a new value. How do I suppress that? MWE: function result = stuff() result = 0 for i=0:10, j +=…
icehawk
  • 1,145
  • 3
  • 12
  • 21
41
votes
2 answers

How can I append to a vector in Octave?

When ever I have to append to a vector I am doing this. A = [2 3 4] A = [A; 3 4 5] I was wondering if there are any inbuilt functions for this or more elegant ways of doing this in Octave.
Aditya
  • 1,240
  • 2
  • 14
  • 38
40
votes
7 answers

How can I flush the output of disp in Matlab or Octave?

I have a program in Octave that has a loop - running a function with various parameters, not something that I can turn into matrices. At the beginning of each iteration I print the current parameters using disp. The first times I ran it I had a…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
37
votes
1 answer

Selecting only a specific number of rows fulfilling a condition

I currently started to work with octave for some data analysis and have some problems for a specific matrix manipulation. Assume you have the following data matrix: A = 1 11 22 33 44 13 12 33 1 14 33 …
Ruun
  • 521
  • 1
  • 7
  • 12
35
votes
6 answers

How can I start octave from the command line and not the GUI?

I recently installed GNU Octave on my Mac using Homebrew and as soon as I typed octave into bash, it opened up the octave-gui window. The Octave GUI looks quite unappealing (on a mac, at least) so I wanted to use the command line interface. My fix…
akad3b
  • 397
  • 1
  • 3
  • 13
33
votes
3 answers

Submitting Assignment on Coursera ML in Octave

Programming assignment Week 3, Machine Learning, Andrew-ng, Coursera System: Ubuntu 16.04 Octave 4.0.0 Problem: Cannot submit the code to the server. This code was successfully submitted from Windows env. octave:1> submit == Submitting solutions |…
Muhriddin Ismoilov
  • 380
  • 1
  • 4
  • 11
33
votes
5 answers

fminunc alternate in numpy

Is there an alternative to the fminunc function (from octave/matlab) in python? I have a cost function for a binary classifier. Now I want to run gradient descent to get minimum value of theta. The octave/matlab implementation will look like this. %…
Anurag Sharma
  • 4,839
  • 13
  • 59
  • 101
32
votes
3 answers

Can't find x11 terminal in gnuplot Octave on Mac OS

I am running Mac OS Mavericks 10.9.4. Installed Octave 3.8.1 via Homebrew which came with gnuplot 4.6 Have XQuartz 2.7.6 installed. I restarted my computer after all was done. In order to plot in octave-cli everyone states that I should just 'set…
ben39
  • 2,427
  • 4
  • 20
  • 19