octave

Why does Gnu Octave have negative zeroes?

Hello, This is an odd one I'm puzzled about. I recently noticed at the Gnu Octave prompt, it's possible to enter in negative zeroes, like so: octave:2> abomination = -0 And it remembers it, too: octave:3> abomination abomination = -0 In the interest of sanity, negative zero does equal regular zero. But I also noticed that the si...

Running Octave Functions From Shell

Say that I have a script myScript.m, I know I can do the following from shell: octave -q myScript.m and it will run the script. However, what if I have a function myFunction.m, which takes in a string: can I do? octave -q myFunction('myString') ??? Thanks a lot in advance, ...

Sine wave frequency fitting

This question is based on a previous similar question. I have the following equation and an adjusted (some random data): 0.44*sin(N* 2*PI/30) I am trying to use the FFT to get the frequency from the data generated. However the frequency ends up being close but not equal to the frequency (which makes the wave a bit larger than intended)...

Simple MATLAB/Octave simulation

This should be a very simple question for anyone who has some experience in this area, but I'm still new to this. I have the following system (or here is an image with better resolution): Given the following input: u = min(2 - t/7.5, 2*(mod(t, 2) < 1)); I need to plot the output of system y. I am describing the system with the fo...

matlab - creating a single dimensional array from two dimensional parts

hi i have the following situation h = [0,1,1,1; 0,0,0,0; 1,1,1,1]; i'll check incoming values which can range between 0 and rowsize of h, i.e. in this case 2,. so my options are 0,1,2. now i want to create a single dimensional array (let's name it j) as follows whenever the incoming value is 0 j = [0,1,1...

Create CDF for Anderson Darling test for Octave forge Statistics package function

I am using Octave and I would like to use the anderson_darling_test from the Octave forge Statistics package to test if two vectors of data are drawn from the same statistical distribution. Furthermore, the reference distribution is unlikely to be "normal". This reference distribution will be the known distribution and taken from the hel...

Aquaterm: titles and axis labels getting cut off

I'm using aquaterm 1.0.1 through octave and gnuplot - on my mac - to generate printable plots. When aquaterm generates my plots, it has a habit of cutting off or cropping all of the titles and axis labels. Is there another imaging program that works with octave that won't have this problem? Or are there other fixes I haven't thought of?...

Detect Numbers in Octave

I am trying the following right now: function isNum = isItANum(string) isNum = isempty(str2num(string)) end The problem is if I have a date '1998/34/2', I want my function to say no. ...

How do I detect if I'm running MATLAB or Octave?

I need to write code that should run equally well in Octave and on MATLAB. Problem is that it needs to do some GUI stuff, which MATLAB and Octave handle completely differently. Is there a way I can detect if I'm running MATLAB or Octave, in order to call the right function? ...

Is there any good Octave GUI/IDE for Windows?

The default GNU Octave installation comes with a CLI. If the same CLI was inside a Windows Forms or WPF or GTK interface it would be much better, as it would allow: White background Normal copy/past Normal window resizing Better fonts There is any better GUI for Octave already available? ...

compute only diagonals in matrix product in octave

Is there a way in octave to compute and store only the diagonal of a matrix product? Basically like doing vector = diag(A*B); I don't care about any of the values of A*B except those on the diagonal. The matrix to around 80k x 12 and 12 x 80k. So even if I didn't care about the speed/extra memory it simply wont fit in RAM. Strange, ...

How do you save a plot in Octave 3.0.5 if it has latex in it?

My school has Matlab but I can't use it at home so I am trying to learn Octave. I am having trouble saving plots as png files so I can put them in a report. I read you can use print("filename.png") to save the plots, but I am getting some kind of error I am assuming is due to using latex in my labels I am using xlabel('\omega') Error ...

two arrays defining 2d coordinates, as array indices, in matlab/octave

Hi, I have a 2D array, call it 'A'. I have two other 2D arrays, call them 'ix' and 'iy'. I would like to create an output array whose elements are the elements of A at the index pairs provided by x_idx and y_idx. I can do this with a loop as follows: for i=1:nx for j=1:ny output(i,j) = A(ix(i,j),iy(i,j)); end end H...

Octave / Matlab: How to plot the roots of a polynomial

Hi everyone, Im trying to plot the roots of a polynomial, and i just cant get it. First i create my polynomial p5 = [1 0 0 0 0 -1] %x^5 - 1 r5 = roots(p5) stem (p5) Im using the stem function, but I would like to remove the stems, and just get the circle around the roots. Is this possible, is stem the right command? Thanks in adva...

How can I get a list of all the defined variables in Matlab or Octave?

I'm used to working in Matlab using its full GUI environment. Due to license issues I went and installed Octave, but it appears that it doesn't have a GUI, at least not one that's installed by default. I transferred the variables from Matlab to Octave by saveing them in Matlab and loading them in Octave. Thing is, I don't remember the...

How can I see the stack trace in Octave's debug mode

I have a failure in some inner library function in Octave. I want to debug the calling function, but I don't know how to do it. How can I see the stack trace? How can I move between frames? ...

Octave / Matlab: Extend a vector making it repeat itself?

Hi everyone, Is there a way to extend a vector by making it repeat itself? >v = [1 2]; >v10 = v x 5; %x represents some function. Something like "1 2" x 5 in perl Then v10 would be: >v10 1 2 1 2 1 2 1 2 1 2 This should work for the general case, not just for [1 2] Thanks in advance ! ...

Loopless function calls on vector/matrix members in Matlab/Octave

I came into matrix world from loop world (C, etc) I would like to call a function on each individual member of a vector/matrix, and return the resulting vector/matrix. This is how I currently do it: function retval = gauss(v, a, b, c) for i = 1:length(v) retval(i) = a*(e^(-(v(i)-b)*(v(i)-b)/(2*c*c))); endfor endfunction Exam...

How do I declare a symbolic matrix in Octave?

In MatLab, you can declare symbols pretty easily: syms a,b mat = [a,b] I'm getting an error, however, when I try to replicate this in Octave. This is the code I'm using: > symbols > a = sym("a") a = a > b = sym("b") b = b > mat = [a,b] error: octave_base_value::resize (): wrong type argument `ex' error: octave_base_value::resize ()...

Octave: importing a large matrix in csv format

I'm trying to import a matrix (about 80.000 rows) from a csv file to Octave. The obvious solution seems something like: load("-ascii","relative_directory/the_file.csv") or maybe renaming the file and trying: load("-ascii", "relative_directory/the_file.txt") Yet I keep getting the error: load: failed to read matrix from file "...