octave

How do I create a simple Octave distributable without installing Octave

点点圈 提交于 2019-11-26 18:08:08
问题 The Octave documentation on this subject is both intimidating and sparse. I did not know where else to document the solution I found, so I am posting here. I apologize if that's inappropriate, but I want to help the next guy. The following solution is for a simple windows distributable. Use Case: A solution is developed in Octave 3.2.4, and needs to be distributed to end-users with few computer skills. Installing and explaining Octave is impossible, the solution must be "one-click" or "brain

Why is reshape so fast?

半腔热情 提交于 2019-11-26 16:43:29
问题 I have a big matrix A which is 1GB of double values, when I reshape it to different dimensions, it's incredible fast. A=rand(128,1024,1024); tic;B=reshape(A,1024,128,1024);toc Elapsed time is 0.000011 seconds. How can it be that fast? Another observation, MATLAB uses less memory than it should after running that code and storing two matrices of 1GB each: Memory used by MATLAB: 1878 MB (1.969e+09 bytes) 回答1: Explanation of the good performance Matlab uses copy-on-write whenever possible. If

Getting FFT peaks from data

让人想犯罪 __ 提交于 2019-11-26 14:45:16
I am developing a speech recognition system from scratch using Octave. I am trying to detect phonemes by detecting differences in frequency. Currently I have read in a wav file, organized the values into blocks and applied fft to the overall data. After, I plot the new data with plot(abs(real(fft(q)))) which creates this graph: How could I get the frequency values (the peaks of the graph)? If you don't have access to findpeaks , the basic premise behind how it works is that for each point in your signal, it searches a three element window that is centred at this point and checks to see whether

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

删除回忆录丶 提交于 2019-11-26 11:21:12
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] Andrew Shepherd The function you're looking for is repmat() . v10 = repmat(v, 1, 5) Obviously repmat is the way to go if you know in which direction you want to expand the vector. However, if you want a general solution that always repeats the vector in the longest direction, this combination of repmat and indexing should do the trick: v10=v

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

最后都变了- 提交于 2019-11-26 11:15:49
问题 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? 回答1: You could use the following test to differentiate Octave from MATLAB: isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0; 回答2: There is also a hint in the wiki on the official octave.org website. They propose the

“Undefined function 'function_name' for input arguments of type 'double'.”

南笙酒味 提交于 2019-11-26 10:34:53
A question that pops up quite frequently in different shapes and sizes is: Why do I get the following error message: "Undefined function 'function_name' for input arguments of type 'double'." This post attempts to address all the different scenarios where this error message can occur, and propose solutions for how it can be resolved. If you stumble upon this error message and don't know what it means. Take comfort in this: 90% of us have googled the same phrase. "Undefined function 'int' for input arguments of type 'double'." The error message is pretty self-explanatory, but may still cause

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

五迷三道 提交于 2019-11-26 08:56:29
问题 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) would be: -1 4 1 3 5 7 But the output of sort(data) is: -1 3 1 4 5 7 How can I sort this matrix by the first column? 回答1: I think the sortrows function is what you're looking for. >> sortrows(data,1) ans = -1 4 1 3 5 7 回答2: An alternative to sortrows() , which can

How can I plot a function with two variables in octave or matlab?

大兔子大兔子 提交于 2019-11-26 08:26:37
问题 I want to use octave to plot fairly simple functions with two variables like: f(x,y) = x^2 + 3y . It is very easy to plot single variable functions, but I am having a lot of trouble finding out how to do two variable functions. Does anyone know the best way of doing this? 回答1: Plotting a function of two variables would normally mean a 3-dimensional plot - in MATLAB you would use the function plot3 for that. To plot your function f(x,y) in the interval [-10,10] for both X and Y, you could use

Getting FFT peaks from data

…衆ロ難τιáo~ 提交于 2019-11-26 04:00:05
问题 I am developing a speech recognition system from scratch using Octave. I am trying to detect phonemes by detecting differences in frequency. Currently I have read in a wav file, organized the values into blocks and applied fft to the overall data. After, I plot the new data with plot(abs(real(fft(q)))) which creates this graph: How could I get the frequency values (the peaks of the graph)? 回答1: If you don't have access to findpeaks , the basic premise behind how it works is that for each

“Undefined function 'function_name' for input arguments of type 'double'.”

佐手、 提交于 2019-11-26 03:28:55
问题 A question that pops up quite frequently in different shapes and sizes is: Why do I get the following error message: \"Undefined function \'function_name\' for input arguments of type \'double\'.\" This post attempts to address all the different scenarios where this error message can occur, and propose solutions for how it can be resolved. 回答1: If you stumble upon this error message and don't know what it means. Take comfort in this: 90% of us have googled the same phrase. "Undefined function