# Questions tagged [octave]

1676 questions

0

votes

0

answer

5

Views

### Is there a way to make octave interpret strings in static text of uicontrol using TeX (Greek letters, subscripts, superscripts etc.)?

I am writing a GUI in GNU octave (5.1.0). It is supposed to read some input values, make some calculations, plot some graphs and write the results. Everything works well besides the unwanted fact that uicontrol displays the given string uninterpreted (Greek letters, subscripts, superscripts etc.). I...

1

votes

2

answer

700

Views

### “Couldn't resolve hostname” while installing package in Octave

I have tried installing a package in Octave using this command:
pkg install signal-1.4.0.taz.gz
but I received the following error:
error: pkg: failed to read package 'signal-1.4.0.taz.gz': Couldn't resolve host name
error: called from
pkg at line 429 column 17
Does somebody know what that means?

1

votes

1

answer

28

Views

### How to pretty print a matrix in Octave?

I want to create a pretty printed table from a matrix (or column vector).
For Matlab there are several available functions that can do this (such as printmat, array2table, and table), but for Octave I cannot find any.
So instead of:
>> a = rand(3,2)*10;
>> round(a)
ans =
2 10
1 3
2 1
I woul...

0

votes

0

answer

2

Views

### How to plot data from a csv file with 7 columns and 20001 rows?

I have instruments that sample data a .00025 (quarter mil) rate. I typically record 10-20 seconds of data which gives me 40K-80K lines and 7 columns. I need to plot some of that data in wave form to illustrate displacement amongst other things. Need direction new to this MATLAB/Octave world.
Examp...

1

votes

2

answer

76

Views

### Are there C like pre-processor directives for Octave and Scilab to be used for intercompatible code?

In C / C++ languages one can use macros or as called 'per-processor directives' to instruct the compiler how the code should be read. The simple commands of #def, #ifdef, #ifndef, #else, #endif ... give the compiler the ability to check for Operating system, compiler and other environment informatio...

1

votes

2

answer

39

Views

### How to vectorize calculation of homogenous transformation matrix/tensor?

For my simulation I need to calculate many transformation matrices therefore I would like to vectorize a for-loop that I'm using right now.
Is there a way to vectorize the existing for-loop or do I probably need another approach in calculating the vectors and matrices before?
I prepared a little wor...

1

votes

1

answer

827

Views

### Create and plot a piecewise function in Octave

So I want to plot this function
enter image description here
for -1
First I created the piecewise function
function x = pieceWise(t)
if t >= 0 & t

1

votes

0

answer

452

Views

### How to run xmlread function in Octave?

When I run xmlread function in Octave, I get
>> xmlread()
warning: the 'xmlread' function is not yet implemented in Octave
Please read to learn how you can
contribute missing functionality.
error: 'xmlread' undefined near line 1 column 1
I have found a documentation, saying it is in io package of O...

1

votes

0

answer

193

Views

### Plotting Octave Plots in RMarkdown

I am trying to knit Octave code in Rmarkdown , it works fine for printing and text based output , but not knitting the plots to html.
```{octave,engine.path='/usr/local/bin/octave/',results='asis',echo= TRUE}
x = -10:0.1:10; # Create an evenly-spaced vector from -10..10
y = sin (x); # y is also...

1

votes

0

answer

120

Views

### system identification using Least mean square algorithm

I am studying about system identification using Least Mean Square algorithm. I tried with some code using the equations for LMS. Based on the algorithm steps, the calculation of the error and weight updates looks alright. However, it fails to give the correct output. Can somebody please help in fixi...

1

votes

1

answer

115

Views

### Octave - Z axis vector arrowhead

I have three vectors I want to display in a plot. , , and .
This is my code:
X = xlabel('X');
Y = ylabel('Y');
Z = zlabel('Z');
axis([-1 1 -1 1 -1 1],'square');
hold on
vx = quiver3(0,0,0,1,0,0)
hold on
vy = quiver3(0,0,0,0,1,0)
hold on
vz = quiver3(0,0,0,0,0,1)
set([vx,vy,vz], 'Color', 'black');
s...

1

votes

0

answer

176

Views

### Octave. DC after apply high pass filter

I'm writting an script to apply a high pass filter to an ECG signal with Octave, using the remez function. The code, basically, is like this:
fs = 500; % sampling frequency
nyq = fs/2; % Nyquist frecuency
% remez parameters
N = 256; % filter order
f1 = 0.2; % begin of transition band in h...

1

votes

1

answer

36

Views

### Octave interpret loop variable differently?

Can someone explain why this is happening
disp(sprintf('Value of i = %d\n', i)); and
disp(sprintf('Value of i = %d\n', i**i)); are interpreted differently in below code!
octave:1> load monk.dat
octave:2> whos
Variables in the current scope:
Attr Name Size Bytes Class
===...

1

votes

0

answer

57

Views

### GNU/Octave - Errors on Callbacks

I'm currently working on an MATLAB project in class, but I work at home with Octave, and I have a problem with the GUI's callback.
The following code is coded on Octave, I haven't tested it with MATLAB yet.
Here is the 'main' function :
tomography_gui.m
function tomography
[blahblahblah]
%%%%%%%%%%%...

1

votes

0

answer

444

Views

### Octave GUI not launching on MacOS 10.11

I am currently using MacOS 10.11.6.
I installed the latest Octave as the wiki explains using Homebrew, specifically the tap homebrew/core.
When I launch it from the terminal, everything works fine, and no error is raised except for the fact that the GUI does not launch (even using the --force-gui fl...

1

votes

0

answer

52

Views

### How can completely disable Octave plotting

I am running an Octave script in headless mode using DISPLAY='' octave --eval myscript; but still get ASCII plots in the commandline output. This seems to be based on gnuplot (graphics_toolkit() = gnuplot). How do I get rid of all console output from the plot() command? I still would like the graphi...

1

votes

0

answer

65

Views

### Using CAS (Sage,Maxima,Octave?) with PHP (Linux), Converting LaTex to Sage / Octave script

Hi for my student project I need to send a math expression (translated in TeX,LaTeX) from php server to some CAS and recieve its result back , translate it into LaTex (and e.g. compare it with my answer). I'm considering to use Sage(via console somehow) or Octave(octave-daemon?).
I am new in web de...

1

votes

1

answer

109

Views

### Moving a Circle in Octave 4.2.1 Using set() and drawCircle()

I am attempting to write a code that simulates the motion of each planet around the sun in the solar system using a graph in Octave 4.2.1. One aspect of this project is to have the sun and all the planets on the graph be circles of a certain size (i.e. a specific radius) and to have each circle movi...

1

votes

1

answer

241

Views

### Only half of the line visible in GNU Octave command window and editor in Ubuntu 14.04?

I have attached screenshot for clarity regarding the question. Restarting the system or re-installing(by purging first) does not seem to work. The command line version of gnu-octave works fine.

1

votes

0

answer

86

Views

### Octave: xlsread - warning: UnZip failed with error 9

I am trying to run xls read on octave and after installing all the packages ( io, symbolic, window etc.)
When I tried to run
xlsread('file.xlsm','Sheet')
It shows this error :
Unzip: cannot find zipfile directory in one of the file.xlsm or
file.xlsm.zip Warning: Unzip failed with error 9

1

votes

0

answer

48

Views

### octave slow, optimisation advice needed

The loop takes a long time to execute. Is there a faster way of processing the loaded file?
a = fileread ('C:/Backup/Thermo Backups/2018-05-17.txt');
d = strsplit (a, '\n');
for i = 1 : length(d)
e (i , :) = strsplit ( d{i} );
endfor
f = cellfun(@str2num, e)
Data sample:
2 36.5333 43 43 43 4...

1

votes

1

answer

99

Views

### How to setup VLFEAT on Octave?

The instructions on the official website aren't clear. Does anyone know how to setup VLFEAT on Octave(Windows)?

1

votes

1

answer

104

Views

### add tabs (spaces) to strings in plots for Octave / Matlab

How can I add tabs (spaces) to strings for plots in Octave see code below. It doesn't create a tab (There should be a tab between Signal and Max Freq in the plot)
Also it produces warning messages
warning: text_renderer: skipping missing glyph for character '9'
warning: called from
annotation>update...

1

votes

1

answer

41

Views

### How do I get nbit types from fread?

I have a file that is a concatenation of K, 17-bit, little endian, unsigned integers. In Matlab I am able to use fread(fd, K, 'bit17', 'ieee-le'). How do I read 17 bits off of a file descriptor in octave?

1

votes

2

answer

109

Views

### octave interactive shell using php proc_open

I 'm writing a PHP code to be executed under apache (unfortunately under window OS by using xampp PHP 7.2.x). The PHP script should call an octave in an interactive way in order to be able to execute more commands in sequence without creating for each one a dedicated octave process.
here below an P...

1

votes

1

answer

64

Views

### Generating a Histogram by Harmonic Number

I am trying to create a program in GNU Octave to draw a histogram showing the fundamental and harmonics of a modified sinewave (the output from an SCR dimmer, which consists of a sinewave which is at zero until part way through the wave).
I've been able to generate the waveform and perform FFT to ge...

1

votes

0

answer

72

Views

### Octave crashes due to clearing variables in script without breakpoints - Attempts to write to last memory block

On my system (Windows, 8 GB RAM 64-bit i7), Octave is having this problem handling medium sized arrays. I have task manager open, and the memory never going beyond 200 MB before the graphing section. It will often crash around 150 MB. The interesting thing is that if I put breakpoints into my code t...

1

votes

1

answer

139

Views

### how to fix xlsread error on octave on ubuntu

I am trying to read a simple xls file with xlsread in octave. Its csv version is shown below:
2,4,6
8,10,12
14,16,18
20,22,24
I have run the following commands in octave:
# the next commands are to select the file through a gui.
# it reports a warning, but selects the filename correctly
>> pkg load...

1

votes

0

answer

124

Views

### Octave: how to implement outer product for arbitrary functions and arbitrary number of arguments?

I now that in Mathematica you can use the general outer product acting on a given function f and some lists l1, l2,l3,..., ln, such that the output out is a n-D-array/list with elements out(i1,i2,...,in) = f(l1(i1),l2(i2),...,ln(in)). The function can do whatever you want.
How do you do the same in...

1

votes

0

answer

33

Views

### octave symbolic divide expression as partfrac does but the factors in N-sized vector

For this particular expression (but not only for it)
>> n(1)
ans = (sym) R₁⋅(I₁⋅(C₂⋅R₁⋅R₂⋅s + R₁ + R₂) + V₂)
i want what octave symbolic package's partfrac does
>> partfrac(n(1),I1)
ans = (sym)
⎛ 2 2 ⎞
I₁⋅⎝C₂⋅R₁ ⋅R₂⋅s + R₁ + R₁...

1

votes

1

answer

50

Views

### Unexpected results using octaveFilter in Matlab

I'm aiming at obtaining a 1/3 octave band frequency signal for specific centre frequencies.
I want to use Matlab's octaveFilter functionality but I was expecting to get a single 1/3 octave band peak at 1000 Hz, but instead far left and far right of 1000 Hz very positive sound pressure levels were co...

0

votes

0

answer

7

Views

### Is it possible to execute a '.m' file from windows cmd like python

Please bear with me, I'm neither an Octave developer or Windows cmd developer. However I have found myself in a situation where the path of least resistance would be a cli solution. From Linux or Windows for that matter I can run Python ['test'].py - and expect to see nothing or something depending...

1

votes

0

answer

38

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, the changes I make are not saved (not even if I restart). I tried to modify the path also using Ra...

1

votes

0

answer

28

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-5);
[t f] = fminunc(@flatTriangle,T0(:),option);
t = reshape(t,3,3);
And following octave functions
function [cost...

1

votes

0

answer

66

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
Now I can't use qqplot(x).

1

votes

0

answer

56

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 Figure below:
Since the scour hole is symmetric around the vertical axis, I cropped the image keeping...

1

votes

0

answer

30

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,data1,data2,data2);
ylabel(at(1),'Concentration of O_2 (mol/m^3)');
print(gcf,file);
I'm using the qt gra...

1

votes

1

answer

42

Views

### How to set tics in x or y axis using range in GNU Octave?

length of x = 1000,
length of y = 1000
plot(x, y, '+');
xlabel ('p');
ylabel ('Q(p)');
title('Custom plot');
set(gca, 'xtick', [0.00000 0.20000 0.40000 0.60000 0.80000 1.00000])
This set command creates 6 tics in X axis, but I like to create 20 ticks so that there are 50 elements in betwee...

1

votes

1

answer

216

Views

### How to create table in Octave with border?

I want to create a table which looks like this Table01.
Where each column is a vector.
I tried with Octave data frame package but it is not generating table as I expected (With border)
Previously I tried with [t,I_X,I_Y] = table(x,y) which is also not satisfactory.
How can I generate table like th...

1

votes

0

answer

40

Views

### Box plots, plots in octave

I'm new to Octave, so there are many confusing things for me, and I've never done computer programming before so most of the language is also confusing.
I have sets of data c_o, m_o, y_o, k_o as 144 x 1 matrices (column vectors?)
Box plots
Using examples I found online, I wrote this:
axis ([0,5]);
b...