octave

Pass filename to windows batch (.bat) script when double clicking so that it will run in octave

三世轮回 提交于 2019-12-07 20:18:27
问题 I'm new in using batch scripts, and moderately experienced with octave. I have a lot of data files I examine with octave functions and I am trying to set up so that I can double click on files with a custom extension to directly open octave functions. Think "when I double click on this text file, it opens in notepad." To do this I've written a very basic .bat file and I've associated my .data files to open using this .bat file. The .bat file looks like this: C:\Octave\Octave-4.2.1\octave.vbs

Matlab/Octave addition, losing digits of precision

非 Y 不嫁゛ 提交于 2019-12-07 17:29:39
问题 In Matlab/octave, when I add two numbers, I am losing some of my digits. >>> 23.0 + 0.65850 ans = 23.659 How do I get back a double that is 23.65850 ? 回答1: The number is being rounded only for display purposes. Take a look at the format command if you wish to change it. octave> 23 + 0.65850 ans = 23.659 octave> format free octave> 23 + 0.65850 ans = 23.7 octave> format long g octave> 23 + 0.65850 ans = 23.6585 Take a look at help format for the other options but remember, that this only

Octave JIT compiler. Current state, and minimal example demonstrating effect

妖精的绣舞 提交于 2019-12-07 16:23:33
问题 I hear very conflicting information about Octave's experimental JIT compiler feature, ranging from "it was a toy project but it basically doesn't work" to "I've used it and I get a significant speedup". I'm aware that in order to use it successfully one needs to Compile octave with the --enable-jit at configure time Launch octave with the --jit-compiler option Specify jit compilation preference at runtime using jit_enable and jit_startcnt commands but I have been unable to reproduce the

How can I convert an RGB histogram into a color spectrum?

て烟熏妆下的殇ゞ 提交于 2019-12-07 15:02:30
问题 How can I convert an RGB histogram of an image to create a histogram showing the combined colors along with correct color wavelength range? Example code: pkg load image f=imread('/tmp/marbles.jpg'); f=uint8(f); %need to convert back to uint8 to show picture %Split into RGB Channels f_red = f(:,:,1); f_green = f(:,:,2); f_blue = f(:,:,3); %Get histValues for each channel [y_f_red, x] = imhist(f_red); [y_f_green, x] = imhist(f_green); [y_f_blue, x] = imhist(f_blue); subplot (2,1,1); imshow(f);

How to know what word appears most in a paragraph? (Matlab)

牧云@^-^@ 提交于 2019-12-07 12:53:39
问题 I have a huge paragraph and want to know what word appears most in it. Could anyone please point me in the right direction with this? Any examples and explanations would be helpful. Thanks! 回答1: Here is a simple solution, should be quite fast. example_paragraph = 'This is an example corpus. Is is a verb?'; words = regexp(example_paragraph, ' ', 'split'); vocabulary = unique(words); n = length(vocabulary); counts = zeros(n, 1); for i=1:n counts(i) = sum(strcmpi(words, vocabulary{i})); end

Octave GNU: Undefined variable 'x' , even though it's defined as function input

 ̄綄美尐妖づ 提交于 2019-12-07 11:58:31
问题 just trying to write a simple program to find the gcd of n numbers. I have no clue how to fix this error, i've read all of octaves function documentation and tried to find questions like this ... Just started programming in Octave btw. Here's the code: function divisor = gcd(x, y) q=0; r=0; l=0; h=0; if(x>y) h=x; l=y; elseif(x<y) h=y; l=x; else h=y; l=x; endif while(r != 0) q=floor(h/l); r = h-l*q; q=h; r=l; endwhile divisor = q; printf("%d", q); return; endfunction The Error: error: 'x'

What is the algorithm used to interpolate in Matlab's imresize function?

怎甘沉沦 提交于 2019-12-07 11:57:13
问题 I am using the Matlab/Octave imresize() function which resamples a given 2D array. I want to understand how a particular interpolation algorithm used in imresize works. (I am using octave on windows) e.g. A = 1 2 3 4 is a 2D array. Then I use the command b=imresize(a,2,'linear'); basically upsampling row and columns by 2. The output is 1.0000 1.3333 1.6667 2.0000 1.6667 2.0000 2.3333 2.6667 2.3333 2.6667 3.0000 3.3333 3.0000 3.3333 3.6667 4.0000 I don't understand how this linear

Converting MATLAB files to Octave

本小妞迷上赌 提交于 2019-12-07 10:02:05
问题 I have a series of experiments that were written for MATLAB, but recently we are trying to run them through Octave instead. I realize they are mostly compatible, but I have been running into a few problems, and none of the online FAQs or directions I have found have addressed these at all. It's complicated a bit because there are multiple .m files that interact; however, for now I am going to focus on the main program. Anyway, so when I try to run the file (MLP.m) through octave, I get the

Call GNU Octave functions in C?

谁说我不能喝 提交于 2019-12-07 09:32:26
I want to use matrix algebra and optimization. I have tested different C and C++ libraries for matrix algebra but the problem with those is they cannot handle garbage data as good as GNU Octave does. Garbage data in C and C++ goes low to like e-8 but in GNU Octave it will be pushed down way to low as e-17. That's very useful if you planning to use garbage data from e.g measurement in calculations. They don't effect nothing of your results. But GNU Octave have a C++ API, which I don't really understand how to use. But I want to use C and call GNU Octave functions from C. Is that possible that I

Animate trajectory using Octave

橙三吉。 提交于 2019-12-07 09:30:25
问题 I have a set of (x,y) coordinates that describe the trajectory of an object. I'd like to animate this trajectory using GNU Octave. The data set is quite large so I won't be able to redraw the entire plot at every iteration if I want the animation to be smooth. What functions are there that would allow me to "update" a plot rather than redraw it? Also, I have another set of (vx,vy) points, which describe the speed of the object. I'd like my animated trajectory to take speed into account. What