octave

Three dimensional (3D) matrix interpolation in Matlab

泪湿孤枕 提交于 2019-11-29 02:45:10
I have a 3D matrix in Matlab of certain size, however I would need to interpolate it to obtain matrix of larger size. size(M) ans= 50 108 86 I need that matrix to be interpolated and finally obtain a matrix of size 100x213x140 . Any ideas of how to do it using interp3 ? Is this possible at all? I've tried Vq = interp3(M,1:100,1:213,1:140) Error using griddedInterpolant/subsref The input data has inconsistent size. Error in interp3 (line 178) Vq = F(Xq,Yq,Zq); If I use meshgrid : [X,Y,Z] = meshgrid(1:100, 1:213, 1:140); Vq =interp3(M,X,Y,Z); Matlab seems to like it, however two things happen:

How can I flush the output of disp in Matlab or Octave?

送分小仙女□ 提交于 2019-11-29 02:08:34
问题 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 longer see them. My guess is that they're stuck in a buffer, and I'll see them when the program ends or the buffer fills. Is there any way to force a flush of the

Interfacing octave with C#

狂风中的少年 提交于 2019-11-29 01:16:40
I have developed a program in Octave to which I would like to add a GUI layer. I want to create an executable program in C# that I can distribute but want to stick with the linear algebra constructs of Octave without having to implement them on my own. Particularly, I want basic matrix, vector operations and optimization functions (like fminunc and fmincg ). What is the best way to achieve this? Appropriate C# linear algebra library, perhaps? There are lots of math libraries for c#. Math.NET Numerics seems to be a good free alternative. There are also commercial implementations. Another

Why does Gnu Octave have negative zeroes?

早过忘川 提交于 2019-11-29 01:08:36
This is an odd one I'm puzzled about. I recently noticed at the Gnu Octave prompt, it's possible to enter in negative zeroes, like so: octave:2> abomination = -0 And it remembers it, too: octave:3> abomination abomination = -0 In the interest of sanity, negative zero does equal regular zero. But I also noticed that the sign has some other effects. Like these: octave:6> 4 * 0 ans = 0 octave:7> 4 * -0 ans = -0 octave:8> 4 / 0 warning: division by zero ans = Inf octave:9> 4 / -0 warning: division by zero ans = -Inf As one can see, the sign is preserved through certain operations. But my question

Can't find x11 terminal in gnuplot Octave on Mac OS

拜拜、爱过 提交于 2019-11-28 22:13:34
问题 I am running Mac OS Mavericks 10.9.4. Installed Octave 3.8.1 via Homebrew which came with gnuplot 4.6 Have XQuartz 2.7.6 installed. I restarted my computer after all was done. In order to plot in octave-cli everyone states that I should just 'set terminal x11' BUT I don't even have x11 listed when I run 'set terminal' in gnuplot Of course octave-cli will complain that my terminal is unknown. octave:1> x=1; octave:2> plot(x); gnuplot> set terminal aqua enhanced title "Figure 1" size 560 420

Octave plotting error

假装没事ソ 提交于 2019-11-28 21:36:55
I am new to octave, I just tried my first plotting with Octave 3.4.0 when I get the following error. Any help will be much appreciated. The gnuplot version is 4.6 octave-3.4.0:3> x=1:1:20; octave-3.4.0:4> y=sin(x); octave-3.4.0:5> plot(x,y) gnuplot> set terminal aqua enhanced title "Figure 1" size 560 420 font "*,6" ^ line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list The terminal window I am using for octave is the mac X-terminal. Ok, I found the solution to this problem. Just run: setenv("GNUTERM","X11") Before you plot anything, e.g., plot(x,y) You might need to

What are the second-moments of a region?

寵の児 提交于 2019-11-28 20:51:48
I'm currently working on replicating some of the functionality of Matlab's regionprops function in Octave. However, I have a bit of a hangup on a subset of the functionality. The 'Eccentricity', 'MajorAxisLength', 'MinorAxisLength' and 'Orientation' properties are my sticking point. In the documentation, they all derive from "...the ellipse that has the same second-moments as the region." So my question is, what are these second-moments, and how do I find them? I was looking at this link: http://en.wikipedia.org/wiki/Image_moments Honestly, it's just left me more confused. Can anyone point me

How to compute only the diagonal of a matrix product in Octave?

廉价感情. 提交于 2019-11-28 20:43:35
Is there a way in Octave to compute and store only the diagonal of a matrix product? Basically like doing: vector = diag(A*B); I don't care about any of the values of A*B except those on the diagonal. The matrix sizes are around 80k x 12 and 12 x 80k , so even if I didn't care about the speed/extra memory it simply wont fit in RAM. Strange, since Octave is a package for huge data sets and diagonals are very important, so it should be possible. The first element in the diagonal is the scalar product of the first row of A with the first column of B. The second element in the diagonal is the

Finding a curve to match data

╄→гoц情女王★ 提交于 2019-11-28 18:58:06
I'm looking for a non-linear curve fitting routine (probably most likely to be found in R or Python, but I'm open to other languages) which would take x,y data and fit a curve to it. I should be able to specify as a string the type of expression I want to fit. Examples: "A+B*x+C*x*x" "(A+B*x+C*x*x)/(D*x+E*x*x)" "sin(A+B*x)*exp(C+D*x)+E+F*x" What I would get out of this is at least the values for the constants (A, B, C, etc.) And hopefully stats about the fitness of the match. There are commercial programs to do this, but I expected to be able to find something as common as fitting to a desired

Gradient Descent implementation in octave

有些话、适合烂在心里 提交于 2019-11-28 16:41:19
I've actually been struggling against this for like 2 months now. What is it that makes these different? hypotheses= X * theta temp=(hypotheses-y)' temp=X(:,1) * temp temp=temp * (1 / m) temp=temp * alpha theta(1)=theta(1)-temp hypotheses= X * theta temp=(hypotheses-y)' temp=temp * (1 / m) temp=temp * alpha theta(2)=theta(2)-temp theta(1) = theta(1) - alpha * (1/m) * ((X * theta) - y)' * X(:, 1); theta(2) = theta(2) - alpha * (1/m) * ((X * theta) - y)' * X(:, 2); The latter works. I'm just not sure why..I struggle to understand the need for the matrix inverse . Shaun Ryan What you're doing in