octave

Octave datatypes - float & double

I'm writing a framework for writing HDF files with JAVA (Using some existing framework). I need to keep compatibility with octave. That is, octave should be able to read the files my framework writes and vice versa. My question is, does Octave have two data types - float and double or it uses only double? thanks ...

Typecast to an int in Octave/Matlab

I need to call the index of a matrix made using the linspace command, and based on somde data taken from an oscilloscope. Because of this, the data inputed is a double. However, I can't really call: Time[V0Found] where V0Found is something like 5.2 however, taking index 5 is close enough, so I need to drop the decimal. I used this ...

What's the fastest way to approximate the period of data using Octave?

I have a set of data that is periodic (but not sinusoidal). I have a set of time values in one vector and a set of amplitudes in a second vector. I'd like to quickly approximate the period of the function. Any suggestions? Specifically, here's my current code. I'd like to approximate the period of the vector x(:,2) against the vector t....

In GNU Octave is there a command to show all the available matrices?

I dont have MatLab so I used Octave to import a .mat file by doing load some.mat . Now how do I know what vectors/matrices have I loaded? ...

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 brazillion warnings, and then I also got these prints. Now that I cleaned them up, I no l...

What are the possible ways to play audio from octave on a Mac?

playaudio() dies because there's no /dev/dsp. None of the outputs from saveaudio() in various formats seem to be playable in QuickTime or VLC. Ideal of course would be something like playaudio(), saving a file and playing it is a work-around that's hideously sub-optimal, but better than nothing. ...

Octave: Multiple submatrices from a matrix

I have a large matrix from which I would like to gather a collection of submatrices. If my matrix is NxN and the submatrix size is MxM, I want to collect I=(N - M + 1)^2 submatrices. In other words I want one MxM submatrix for each element in the original matrix that can be in the top-left corner of such a matrix. Here's the code I have...

How can I run Octave under Emacs on Windows (Vista)?

Hello, I installed Emacs 23.1.1 and Octave 3.2.3 on my computer running Vista. To make Emacs find Octave, and to make Octave's prompt what Emacs expects, I added the following to the end of my .emacs file: (setq inferior-octave-program "C:/Octave/3.2.3_gcc-4.4.0/bin/octave-3.2.3.exe") (setq inferior-octave-startup-args (list "--eval...

Using GNU Octave FFT functions

I'm playing with octave's fft functions, and I can't really figure out how to scale their output: I use the following (very short) code to approximate a function: function y = f(x) y = x .^ 2; endfunction; X=[-4096:4095]/64; Y = f(X); # plot(X, Y); F = fft(Y); S = [0:2047]/2048; function points = approximate(input, count) s...

Extrapolation using fft in octave

Using GNU octave, I'm computing a fft over a piece of signal, then eliminating some frequencies, and finally reconstructing the signal. This give me a nice approximation of the signal ; but it doesn't give me a way to extrapolate the data. Suppose basically that I have plotted three periods and a half of f: x -> sin(x) + 0.5*sin(3*x) +...

problems in trying ieee 802.15.4 working from msk

Hi, i took a msk code from dsplog.com and tried to modify it to test the ieee 802.15.4. There are several links on that site for ieee 802.15.4. Currently I am getting simulated ber results all approximately same for all the cases of Eb_No values. Can you help me to find why? thanks in advance! clear PN = [ 1 1 0 1 1 0 0 1 1 1 ...

MATLAB/octave count number of operations (flops)

Is it possible to report number of operations to evaluate for example matrix/matrix (dense or sparse) in MATLAB or octave. ...

Problem using help in Octave

Hi, I cannot get any help information from my octave command prompt. Example, when I enter octave:1>help rand I get the error message error: fwrite: invalid stream number = -1 error: called from: error: /usr/share/octave/3.2.3/m/help/makeinfo.m at line 147, column 5 error: /usr/share/octave/3.2.3/m/help/h...

Tool to diagonalize large matrices

I want to compute a diffusion kernel, which involves taking exp(b*A) where A is a large matrix. In order to play with values of b, I'd like to diagonalize A (so that exp(A) runs quickly). My matrix is about 25k x 25k, but is very sparse - only about 60k values are non-zero. Matlab's "eigs" function runs of out memory, as does octave's ...

Languages for implementing decision trees

What would be a good choice of programming language in which to implement a decision tree? The results of the implementation will be for personal use only, so no need to consider ability to publish etc. I have heard that Octave is a good option, can anyone explain why a matrix based language is recommended for implementing decision tree...

Resize Columnvector in .Oct file

Does anyone know the correct syntax to resize a ColumnVector in a compiled .Oct function written for Octave? The ColumnVector will typically be 10 to 50 elements in length and will be passed to a feval call in a loop. After evaluation, in the next loop iteration, the ColumnVector will need to be resized, filled with new data and again pa...

Octave time series Moving average

I have a matrix with each column represents a feature over time. I need to find the moving average of these values with a given window size. Is there any function like one in matlab output = tsmovavg(vector, 's', lag, dim) ? ...

Medians of upper and lower halves of a vector

I am trying to compile an Octave .oct function to calculate the medians of the upper and lower "halves" of a sorted vector which will vary in length e.g. for an odd length vector such as [5,8,4,6,7] I want the "lower" median value of 4,5 and 6 and the "upper" median value of 6,7 and 8 (6 is part of both calculations), and for an even len...

Zoom out in Octave / gnuplot

I use Octave with gnuplot under Windows. I can zoom in using the right mouse button. But how can I zoom out from the UI? ...

Can this algorithm be simplified (written cleaner) ?

Hi, I have this algorithm, but I am not too keen on the many if-statements. Can someone see if this function can be written in a cleaner way? rand('twister',101) n = 10; f = A.^(0:n)./factorial(0:n); f = f/sum(f); n = 10000; Xi = 2; X = zeros(1,n); for i =1:n, dXi = (-1)^round(rand); Yi = Xi + dXi; if Yi > 0 & Yi <= leng...