octave

Saving .fig file from Octave

时光怂恿深爱的人放手 提交于 2019-12-05 04:26:43
I need to make a .fig file that can be reopened in Matlab, but I am working in Octave. But apparently there is no saveas command in Octave. This is what I am trying: octave:3> plot([1,2,3],[45,23,10]) octave:4> saveas(gcf,'myfig.fig') error: `saveas' undefined near line 4 column 1 octave:4> Currently the Matlab fig file format is a proprietary binary file format. Octave doesn't know how to export to this format and won't be able to until it is reverse engineered. The fig format that Octave knows about is a different fig format used by Xfig with the same extension name, but nothing else in

python vs octave random generator

白昼怎懂夜的黑 提交于 2019-12-05 03:53:09
More specifically, numpy: In [24]: a=np.random.RandomState(4) In [25]: a.rand() Out[25]: 0.9670298390136767 In [26]: a.get_state() Out[26]: ('MT19937', array([1248735455, ..., 1532921051], dtype=uint32), 2,0,0.0) octave: octave:17> rand('state',4) octave:18> rand() ans = 0.23605 octave:19> rand('seed',4) octave:20> rand() ans = 0.12852 Octave claims to perform the same algorithm (Mersenne Twister with a period of 2^{19937-1}) Anybody know why the difference? Unfortunately the MT19937 generator in Octave does not allow you to initialise it using a single 32-bit integer as np.random.RandomState

Overlap between Objective-C and MATLAB/Octave file extensions

丶灬走出姿态 提交于 2019-12-05 02:07:29
问题 Do Objective-C or MATLAB/Octave have source file extensions besides .m ? I ask because I'm putting Hello World programs in a single folder and I can't have two hello.m files. 回答1: A workaround would be to use .mm for Objective-C. .mm is used for Objective-C++ source files and it is a superset of Objective-C so it should compile fine. This is by no mean a clean solution. A much better way would be to reorganize your folder into subfolders as suggested by Ruddy Velthuis, or simply to call your

Matlab performance: comparison slower than arithmetic

自作多情 提交于 2019-12-05 01:04:41
A while back I provided an answer to this question . Objective: count the number of values in this matrix that are in the [3 6] range: A = [2 3 4 5 6 7; 7 6 5 4 3 2] I came up with 12 different ways to do it: count = numel(A( A(:)>3 & A(:)<6 )) %# (1) count = length(A( A(:)>3 & A(:)<6 )) %# (2) count = nnz( A(:)>3 & A(:)<6 ) %# (3) count = sum( A(:)>3 & A(:)<6 ) %# (4) Ac = A(:); count = numel(A( Ac>3 & Ac<6 )) %# (5,6,7,8) %# prevents double expansion %# similar for length(), nnz(), sum(), %# in the same order as (1)-(4) count = numel(A( abs(A-(6+3)/2)<3/2 )) %# (9,10,11,12) %# prevents

What is the fastest way to write a matrix to a text file in Octave?

試著忘記壹切 提交于 2019-12-05 00:15:25
I have a large matrix (2e6 x 3) which I have to write to a text file. dlmwrite takes about 230s to achieve this task. From your experience what is the fastest way to write a large matrix to a text file? The following applies to MATLAB, but I suggest you try it in Octave. First of all, if you can - transpose the matrix. Here are examples using fprintf and csvwrite (essentially dlmwrite ) A = rand(3, 1e6); tic; fid = fopen('data.txt', 'w+'); for i=1:size(A, 1) fprintf(fid, '%f ', A(i,:)); fprintf(fid, '\n'); end fclose(fid); toc tic; csvwrite('data.txt', A); toc; Elapsed time is 1.311512 seconds

Calling .csv file into Octave

我的梦境 提交于 2019-12-04 19:32:21
问题 I have a code written in C++ that outputs a .csv file with data in three columns (Time, Force, Height). I want to plot the data using Octave, or else use the octave function plot in the C++ file (I'm aware this is possible but I don't necessarily need to do it this way). Right now I have the simple .m file: filename = linear_wave_loading.csv; M = csvread(filename); Just to practice bringing this file into octave (will try and plot after) I am getting this error. error: dlmread: error parsing

How can I set the window size of a plot window?

吃可爱长大的小学妹 提交于 2019-12-04 16:32:02
问题 Is it possible to set the window size / position of a plot window (figure)? plot(0:20, sin(0:20)) Or is there any other possibility to change the size of the print() command? print('aa.png', '-dpng') Because the -Sxsize,ysize parameter doesn't change anything. The size of the written picture (aa.png) has always the same size as the plot window. I'm using Octave 3.0. 回答1: Yes, it is possible: figure(1, 'position',[startx,starty,width,height]); plot(0:20,sin(0:20)); [startx,starty] are the

Installing general package in octave has error

99封情书 提交于 2019-12-04 14:21:31
I have error in installing general package using the instruction. pkg install -forge general and get the message octave:3> pkg install -forge general In file included from /usr/local/octave/3.8.0/lib/gcc47/gcc/x86_64-apple-darwin13/4.7.3/include/stdint.h:3:0, from /usr/local/octave/3.8.0/include/octave-3.8.0/octave/oct-conf-post.h:167, from /usr/local/octave/3.8.0/include/octave-3.8.0/octave/config.h:3351, from /usr/local/octave/3.8.0/include/octave-3.8.0/octave/../octave/oct.h:31, from SHA1.cc:19: /usr/local/octave/3.8.0/lib/gcc47/gcc/x86_64-apple-darwin13/4.7.3/include-fixed/stdint.h:27:32:

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

独自空忆成欢 提交于 2019-12-04 13:28:02
问题 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. Ultimately, I'd like to do this for lots of initial conditions and calculate the period of each and plot the result. function xdot = f (x,t) xdot(1) =x(2);

Warnings after octave installation

馋奶兔 提交于 2019-12-04 13:13:41
I am getting following warning after launching octave. i used installation instruction from here . What could be the issue? Are these major warnings? I am using windows. warning: gmsh does not seem to be present some functionalities will be disabled warning: dx does not seem to be present some functionalities will be disabled warning: function C:\Octave\Octave3.6.0_gcc4.6.2\share\octave\packages\statistics- 1.1.0\fstat.m shadows a core library function That's because you have installed packages that you probably do not need (otherwise you would already noticed more than just the warning