# Questions tagged [octave]

GNU Octave is a mathematical software package and scripting language. The scripting language is intended to be compatible with [tag:matlab], and the two packages are almost entirely consistent. The syntax is matrix-based. Octave is implemented in C++. Use either the [tag:octave] tag or the [tag:...

**0**

votes

**0**answers

11 views

### Machine learning course by andrew exercise can run locally but fail to submit?

I am learning machine learning course in coursera and doing the exercise of neural networks. My code can run locally and return the right answer, but it shows wrong when I submit it in octave.
the ...

**0**

votes

**2**answers

22 views

### What is the @ symbol used for in Octave?

What is the @ symbol used for in Octave?
For example, in the code:
[theta, cost] = fminunc(@(t)(costFunction(t, X, y)), initial_theta, options);
I have a general understanding of what the code is ...

**1**

vote

**2**answers

23 views

### Octave axes limits change back to auto after plotting

I am experimenting with octave animations and I have an issue with the following code:
clear
x = 0:pi/1000:2*pi;
y = sin(x);
y2 = sin(2*x);
y3 = sin(3*x);
figure
xlim("manual");
ylim("manual");
xlim([...

**1**

vote

**0**answers

20 views

### Spacing not wrong when printing plot with subscript in ylabel in octave

The spacing on the y axis label get all wrong when printing with print
The code to reproduce the issue is:
data1 = [1:10:100]
data2 = [100:10:200]
file = "plottest.png"
[at ho ht] = plotyy(data1,...

**0**

votes

**0**answers

25 views

### How do I build Octave 3.8.2?

I am trying to use oct2py to run some matlab code because I don't have matlab. I downloaded octave 3.8.2 from the github repo but the readme doesn't help much.
The code loads the data set and passes ...

**-2**

votes

**1**answer

31 views

### Octave 4.4.1 fails to start on 32 bit Windows 7

Octave 4.0.0 works on Windows 7 32 bit. I have just downloaded 4.4.1 and it has never worked.
Following information:
Problem signature:
Problem Event Name: APPCRASH
Application Name: ...

**0**

votes

**0**answers

20 views

### Creating a graphical interface for global variables

I've got this, how do I tell octave that when I push the "run" button I want it to run the script and calculate a taking into account the value of Isc that I have specified in the GUI?
f=figure
% ...

**1**

vote

**0**answers

22 views

### How can I calculate this Curve dissimiliarity indices?

I am trying to find the dissimilarity of two curves (in Octave). This are the four indices (in the picture) which will express which curve is close to the reference curve. Here f is the smoothed ...

**0**

votes

**1**answer

56 views

### What is the error in the iterative implementation of gradient descent algorithm below?

I have attempted to implement the iterative version of gradient descent algorithm which however is not working correctly. The vectorized implementation of the same algorithm however works correctly.
...

**0**

votes

**1**answer

23 views

### How to run an ocatve command from the terminal with several arguments including a matrix?

I want to run a octave script from the terminal with several arguments.
consider the function
function matrixMultiply (A, x)
result = A * x ;
presult = sprintf('%s %s\n', 'A * x =', mat2str(...

**0**

votes

**1**answer

32 views

### Defining Octave Functions

I am working on a school project with Octave for calculating and plotting velocity/acceleration graphs.
I have been trying to create a subplot function so that I won't have to hardcore it for every ...

**0**

votes

**0**answers

31 views

### How to force always solid line plot in Octave

The following script should generate a 440Hz sine wave, display the first part of it as a solid line x-t-plot and play the whole wave on the audio output device:
% Octave script to demonstrate
% ...

**0**

votes

**1**answer

44 views

### How to insert a column of ones and zeros into a matrix using Octave?

Suppose I have a matrix with a set of integers. I want to use the check rand > 0.5 to prepend a random vector of 1s and 0s to my matrix. How could I do this?

**0**

votes

**1**answer

29 views

### Is there a way to edit last Octave command and /or script typed in Octave CLI

typing and executing a single line command in octave cli is simple.
for example a=1.
If one wants to edit this command and execute it again it is possible by navigating the history with the up/down ...

**0**

votes

**2**answers

43 views

### running octave with netcdf package

I am trying to run octave in order to process netcdf files. While I am able to currently run octave successfully I have been having a very difficult time loading the package netcdf for octave.
I ...

**0**

votes

**0**answers

45 views

### Octave: For-Loop creates wrong variables

I want to read parameters from a text file and summarise it to four variables. Because of that many parameters, I decided me to write a for-loop to automate it.
The problem is, that the loop only ...

**-1**

votes

**1**answer

69 views

### Octave execution annoying behavior

I have installed Octave following the steps from this article:
https://medium.com/@manivannan_data/install-octave-on-ubuntu-16-04-d76f97e0d504
The version is 4.2.2, my OS is Linux Mint Sylvia 18.3.
...

**1**

vote

**0**answers

50 views

### Tracing the surface of scour hole using image processing

I have a soil scour hole that evolves with time i.e. scour depth is getting deeper with time. Scour hole seems to be parabolic in shape as shown here:
The requested surface is shown in blue line in ...

**-1**

votes

**0**answers

31 views

### How to use a package in Octave inside a script?

I want to use the normalize function from the octave package ltfat.
can use normalize when I start octave in the terminal since I appended to file /usr/share/octave/site/m/startup/octaverc the line
...

**-1**

votes

**1**answer

31 views

### Octave - fskipl: invalid stream number

I've got the error message: "Invalid parameter list" from my function, which let Octave open a text file and read it to get input data for my work.
function [machNumbers]=readsrm(testfile.txt)
fid ...

**0**

votes

**1**answer

36 views

### How to loop over matrix in Octave to generate cross-term polynomial of order n

What I am trying to do is the following, I have an n x m sized matrix, with n rows of data and m columns. Each of these columns is a different variable (think X, Y, Z, ect...).
What I want is to ...

**4**

votes

**2**answers

67 views

### Why does plotting this equation not generate the correct curve?

The intention is to plot the following equation: P*sin(x)/x + cos(x), for P = 1.6 and x in [0, 5], which, ignoring the green-filled areas, should look someting like:
However, from the following code:
...

**0**

votes

**0**answers

22 views

### How Instantiate an Octave Matrix in Shared Memory Allocated With mmap()?

How Instantiate an Octave Matrix in Shared Memory Allocated With mmap()?
I tried to use placement but it's not working.
void *mem_m = (void *)mmap(NULL, 1000*1000*sizeof(double), PROT_READ | ...

**1**

vote

**1**answer

42 views

### octave: No function and no method found error

I get the following error trying to solve a non linear system in Octave:
error: @Jfun: no function and no method found
error: called from
voc at line 4 column 13
I'm using 4 scripts and I ...

**1**

vote

**1**answer

55 views

### What exactly is first non singleton dimension of a matrix?

Looking at this definition:
: sum (x, dim)
If dim is omitted, it defaults to the first
non-singleton dimension.
I tried few commands:
>> sum([2,3,4]) % A matrix ...

**0**

votes

**0**answers

34 views

### Noncomformant argument in Octave

Why am I getting this error? Where is problem?
>> x=1:1:10
x =
1 2 3 4 5 6 7 8 9 10
>> y=(2*pi)/(x)
error: operator /: nonconformant arguments (op1 is 1x1, ...

**1**

vote

**0**answers

22 views

### Quantile plot in GNU Octave 4.4.1

How to draw Quantile plot in GNU Octave 4.4.1? qqplot is not working in 4.4.1. I think it was supported before 4.2.1. For further investigation, https://octave.org/doc/v4.2.1/Statistical-Plots.html
...

**-1**

votes

**1**answer

27 views

### displaydata function in ex3 coursera machine learning

I am facing a issue, here is my script. some end or bracket issue but I have checked noting is missing.
function [h, display_array] = displayData(X, example_width)
%DISPLAYDATA Display 2D data ...

**-1**

votes

**1**answer

36 views

### How do I make Octave see installed Shogun libraries in Ubuntu 16.04?

I copied the commands (from these instructions: http://www.shogun-toolbox.org/install#ubuntu) into the terminal and they seem to have worked, but there is no documentation on how to make Octave find ...

**1**

vote

**2**answers

35 views

### Dashed line not distinguishable with thick Linewidth

I would like to increase the Linewidth in my legend while also still being able to see that this line is dashed. I have a short sample of what I mean
for i=1:10
x(i)=i;
line1(i)=i;
line2(i)=2*i;
...

**1**

vote

**1**answer

79 views

### Lightspeed breaks Octave Forge package installation- binary operator '==' not implemented

I'm getting the following error while trying to install an Octave package:
binary operator '==' not implemented for 'cell' by 'scalar' operations
error: called from
glob at line 62 column 1
...

**1**

vote

**1**answer

51 views

### Getting value of data point on a plot in octave

I am trying out octave as an alternative to matlab and it looks like the graph plot in octave is not as interactive as matlab
I want to find out the value of the x and y coordinates of a data point ...

**-2**

votes

**1**answer

68 views

### what is Octave equivalent of “freqspace” function of Matlab?

In Matlab we can write,
[u, v] = freqspace(size(I),'meshgrid');
What is Octave's equivalent of "freqspace" function of Matlab?

**-15**

votes

**2**answers

363 views

### Why is the output of `conv2()` is divided by `sz^2`?

The following routine subtract the mean value from the image making it sharper.
im is an image matrix.
sz is an integer.
How this routine works:
Image is first converted to double.
half of sz is ...

**-1**

votes

**1**answer

65 views

### Why does this Gaussian function give nonconformant arguments error?

function m=gaussian(med, var, n)
if ( mod(n, 2)==0 )
n=n+1;
end;
med=double(med);
var=double(var);
med = min (max(-(n+1)/2, med), (n+1)/2);
m=zeros(1,n);
k1=(1/(2*pi*var)^0.5);...

**0**

votes

**1**answer

48 views

### octave use vector as columns index for a matrix

I've a vector y = [1; 1; 2; 3] and a matrix Y = zeros(4, 3).
I need to set to 1 the columns in Y that corresponds to values of the vector y. i.e.
Y = [1, 0, 0; 1, 0, 0; 0, 1, 0; 0, 0, 1]
Y(y) or Y(:...

**0**

votes

**1**answer

24 views

### How to run Octave-4.4 exe from python?

I have searched about this topic but I can not find a solution. There are some libraries oc2py and pytave However, I am newbie about this. I have a batch file, I want to run it from python:
set ...

**2**

votes

**2**answers

36 views

### How can I set a matrix with different, repeating patterns in every column?

I'm trying to set an nx3 matrix in GNU Octave to scatter plot and compare it to a fitted surface which I already solved for and plotted. However this matrix has repeating patterns in columns 1 and 2; ...

**0**

votes

**1**answer

35 views

### How to present stimulus for limited amount of time and still record response using Psychtoolbox

For my experiment I want to present a stimulus and some instructions to the participant. Then 2 seconds later I want the stimulus to disappear but the instructions to remain until the participant ...

**1**

vote

**0**answers

27 views

### Octave fminunc doesn't update

I have the following octave script:
clear;
T0 = [...
1.0, 1.0, 5.0; ...
1.0, 2.0, 3.0; ...
-1.0,0.0, 6.0];
option = optimset('Display','Iter','GradObj','on','MaxIter','300','TolFun',10-...

**0**

votes

**0**answers

39 views

### Expansion on Octave

When I run the following command on Octave,the Octave cannot expand it like Matlab.
syms x y
expand(cos(x+y))
ans = (sym) cos(x + y)
Matlab runs it like this:
ans =cos(x)*cos(y) - sin(x)*sin(y)
...

**0**

votes

**2**answers

72 views

### Non-conformant argument with 3-d matrix and vector

I want to perform the following element-wise addition between a 3-d matrix and a vector.
for l = 1:dim
M_star(j,k,:) .+= 15*x(j,:).*x(k,:).*x(l,:).*x_t(l,:)./(nm.^7) - (l == j)*3*x(l,:).*x_t(l,:)....

**0**

votes

**0**answers

36 views

### how to plot data with 'HH:MM:SS" tick in octave

I want to plot my data(datatest) with respect to time horizon(timetest), and I want the xlabel to be HH:MM:SS even though there are year, month, day data.
I tried with references from here, but the ...

**2**

votes

**2**answers

77 views

### Gradient Descent failing for multiple variables, results in NaN

I am trying to implement gradient descent algorithm to minimize a cost function for multiple linear algorithm. I am using the concepts explained in the machine learning class by Andrew Ng. I am using ...

**1**

vote

**3**answers

44 views

### Octave -inf and NaN

I searched the forum and found this thread, but it does not cover my question
Two ways around -inf
From a Machine Learning class, week 3, I am getting -inf when using log(0), which later turns into ...

**0**

votes

**1**answer

43 views

### Correct Syntax for getting the sum of a matrix - Octave [closed]

I am taking Andrew Ng's class on Machine Learning and within implementing a Regularized Cost Function for a Neural Network, we have to calculate:
Simply put, ignoring the bias units (the first column)...

**1**

vote

**0**answers

27 views

### path too long_truncated at 1024 characters_path cannot be edited

I am kinda stuck here, trying to add octave to my path, which is too long (1024 characters is the maximum). I tried to modify it manually going to Advanced system settings, but after I modify the path,...

**0**

votes

**1**answer

29 views

### Troubles presenting new and random images using Psychtoolbox

I'm fairly new at programming and am attempting to program my first experiment using Psychtoolbox. In this experiment a random number of faces will be shown (1-6 faces), and each face will be ...

**0**

votes

**0**answers

70 views

### 'X' undefined near line 17 column 10 [duplicate]

I am trying to run my script "featureNormalize" but get the error X undefined. However, other scripts are running so no issue for path.
featureNormalize.m
error: 'X' undefined near line 17 column 10
...

**1**

vote

**1**answer

38 views

### Difficulty with Octave's “javaMethod”

In this question, I was trying to import java classes into Octave. In my particular example, I was (and am) working with javaplex, a set of java tools with code for implementation in Matlab. The ...