octave

how to resize x and y axis

蹲街弑〆低调 提交于 2019-12-02 06:20:55
问题 How can I resize x and y axis ? What I want, n more specific; 3900 | . | . | . | 60 | | 30 | |_____________________________ 0 60 120 180 ... 3600 What I have done ; a = [0:0.1:10000]; plot(a); What should I write so that resizing x and y axis is done as expected? EDIT: I do not want; | | | | | | | | | | 3900 | . | . | . | 60 | | 30 | |___________________________________________________________________ 0 60 120 180 ... 3600 回答1: Check the documentation: http://www.mathworks.com/help/techdoc

How to loop two vectors in MATLAB?

笑着哭i 提交于 2019-12-02 05:07:50
In python one can use zip to loop multiple vectors or enumerate to get the current index of the looped vector like so one = ['A', 'B', 'C'] two = [1, 2, 3] for i, j in zip(one, two): print i, j for j, i in enumerate(one): print i, two[j] Gives >>> A 1 B 2 C 3 A 1 B 2 C 3 In MATLAB it's possible to do one = {'A' 'B' 'C'}; two = [1 2 3]; for i = 1:1:length(one) printf('%s %i\n', one{i}, two(i)); endfor j = 1; for i = one printf('%s %i\n', i{1}, two(j)); j = j + 1; endfor giving A 1 B 2 C 3 A 1 B 2 C 3 So is one of those two options the common way how one would do it in MATLAB, i. e. to loop

Are there C like pre-processor directives for Octave and Scilab to be used for intercompatible code?

谁都会走 提交于 2019-12-02 04:47:54
In C / C++ languages one can use macros or as called "per-processor directives" to instruct the compiler how the code should be read. The simple commands of #def , #ifdef , #ifndef , #else , #endif ... give the compiler the ability to check for Operating system, compiler and other environment information. I know Octave and Scilab are interpreted languages, but I'm wondering if is there any way to tell the interpreter to replaces parts of script while loading it? For example can I write a code which is commented based on Scilab syntax // and then instruct the interpreter to read them as Octave

Vectorized exponentiation

爱⌒轻易说出口 提交于 2019-12-02 04:02:00
I have two vectors, X of bases and N of exponents. I want to get the matrix of all values e = x n for each x in X and n in N . For example, the following input: X = [2 3 4]' N = [1 2 3] should produce: ans = [2 4 8; 3 9 27; 4 16 64] Is there a way to get this without looping (just like you can get all values of x×n by using the column by row product)? Use bsxfun : bsxfun(@power, X, N) This assumes that X is a column vector and N is a row vector. If you want to guarantee that, use the following syntax which is more robust: bsxfun(@power, X(:), N(:).') This is probably a bit sloppier than the

Importing Java Classes in Octave

删除回忆录丶 提交于 2019-12-02 03:33:01
问题 I've been having difficulty figuring out how to do this. From the Octave website, it seems that java classes are found via a class path. This Stack Overflow answer indicates that the "static java path" is to the "dynamic java path". Yet I'm not sure how to set up the static java path. In my particular situation of interest, I'm trying to use the javaplex package with Octave - I've contacted the authors of javaplex on Github and they said if Octave can load java classes, then I can use it.

Hide octave-workspace file from home directory

情到浓时终转凉″ 提交于 2019-12-02 03:24:00
问题 I would like to change the file octave-workspace from my home directory, simply renaming it to .octave_workspace . How can I manage to make octave recognize a workspace file (or create a new one) with this new name? Thanks. 回答1: That is the purpose of the octave_core_file_name() function. Add the following to your .octaverc file: octave_core_file_name (".octave-workspace") 回答2: OSX Solution: You can use chflags To hide a file from Finder: chflags hidden /Path/To/File To unhide: chflags

Is the resulting accuracy on matrix manipulation any ill-logical?

送分小仙女□ 提交于 2019-12-02 02:53:56
问题 octave:1> A = [1 2 3; 4 5 6; 7 8 9] octave:2> B = pinv (A) octave:3> I = eye (size (A)) ans = Diagonal Matrix 1 0 0 0 1 0 0 0 1 octave:4> I2 = A * B ans = 0.83333 0.33333 -0.16667 0.33333 0.33333 0.33333 -0.16667 0.33333 0.83333 octave:5> A2 = A * I2 ans = 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 Why could the final Step 5 result in the perfect accuracy although the previous Step 4 in the unforgiving accuracy? @EDIT octave:6> format long octave:7> I2 I2 = 0

Octave/Windows: umlauts in plots displayed but not saved as image

僤鯓⒐⒋嵵緔 提交于 2019-12-02 02:23:35
问题 I use octave 3.8.2 (with gnuplot) under Windows. I want to write "special character" in the axis labels of plots. The umlaut 'ä' and special character µ are displayed in the figure but not saved to the image file using print. Partly, I can use the TeX command: '\mu' instead of 'µ' but for umlauts '\"a' instead of 'ä' does not work. plot(1:10); %set (findall (gcf (), "-property", "interpreter"), "interpreter", "TeX") % does not work xlabel('Länge in µm'); ylabel('Breite in \mum'); print(

how to resize x and y axis

耗尽温柔 提交于 2019-12-02 02:14:15
How can I resize x and y axis ? What I want, n more specific; 3900 | . | . | . | 60 | | 30 | |_____________________________ 0 60 120 180 ... 3600 What I have done ; a = [0:0.1:10000]; plot(a); What should I write so that resizing x and y axis is done as expected? EDIT: I do not want; | | | | | | | | | | 3900 | . | . | . | 60 | | 30 | |___________________________________________________________________ 0 60 120 180 ... 3600 Check the documentation: http://www.mathworks.com/help/techdoc/ref/axis.html axis([xmin xmax ymin ymax]) Another way: xlim([0 3600]) ylim([0 3900]) http://www.mathworks.com

Octave/Windows: umlauts in plots displayed but not saved as image

亡梦爱人 提交于 2019-12-02 01:14:43
I use octave 3.8.2 (with gnuplot) under Windows. I want to write "special character" in the axis labels of plots. The umlaut 'ä' and special character µ are displayed in the figure but not saved to the image file using print. Partly, I can use the TeX command: '\mu' instead of 'µ' but for umlauts '\"a' instead of 'ä' does not work. plot(1:10); %set (findall (gcf (), "-property", "interpreter"), "interpreter", "TeX") % does not work xlabel('Länge in µm'); ylabel('Breite in \mum'); print('umlaute.jpg', '-djpeg'); graphics_toolkit("gnuplot") and pngcairo or pdfcairo produce a better output.