# Tag Info

Accepted

### Computational time not proportional to integration interval in ODE-solver?

Substantially edited, since the original poster changed his equation... In general, the MATLAB (and Octave) ODE solvers dynamically adjust the step size as needed to maintain an accurate solution. ...
• 18.8k
Accepted

### Finite difference method basic implementation on Octave

Summarizing and formulating the answer: (part of it was already given in the comments by user14717, Christian Clason, and Kirill) While performing numerical differentiation using finite differences, ...
• 8,672
Accepted

### Solving constrained odes's using inbuilt solvers in Matlab/Octave

Yes you can. If the term that multiplies $N$ is never zero, then $N$ is an algebraic variable of index 1. Its combination with the ODEs on $x$ yields a system of differentiel-algebraic equations (DAEs)...
• 1,943

### Alternatives to Comsol Multiphysics

You might also want to have a look at: Elmer https://www.csc.fi/web/elmer Kratos http://www.cimne.com/kratos/ OpenFoam http://www.openfoam.com/ CaeLinux http://caelinux.com/CMS/
• 141
Accepted

### Nice plot of f(x)

Using Python and mpmath: import matplotlib import mpmath f = lambda z: z**3-z+1 mpmath.cplot(f, points=100000) Easy peasy.... See here for the documentation on <...
• 6,159
Accepted

### BLAS libraries for Octave or Matlab, preferrably with GPU support?

Among open-source BLAS, as far as I know, OpenBLAS (http://www.openblas.net/) is the best option. The website has a DGEMM benchmark, comparing against MKL (see below) and the reference Fortran BLAS. ...
• 181

### How can I extract the banded or block diagonal part of a sparse matrix in MATLAB?

(This answer is valid for both MATLAB and Octave, even though I mainly refer to MATLAB) There are two beasts to slay; but let's first understand the underlying data structure. MATLAB and Octave store ...
• 2,781
Accepted

### Problem with my Octave code (unsteady heat equation with FEM)

Reading quickly through your code, it seems that you never update B. So the term $T^n$ of the previous step remains unchanged, hence you are effectively computing the same step over and over again... ...
• 1,943
Accepted

### denoting a variable as a matrix using octave syms package

I don't think Octave's syms package supports this kind of matrix algebra operations, but you can do that in Mathematica. EDIT: and also in Sympy.
• 11.5k

### How to vectorize 2 nested for loop with one complex condition in the inner loop?

Another approach is to use the fact that true is equal to $1$ and false is equal to $0$. If both conditions in the ...
Accepted

### Plot a multi-variable equation in (discontinuous) regions

First, you originally wrote that your equation is $\cos(K)=5 \text{ sinc}(5.12\sqrt{E})- \cos(5.12\sqrt{E})$, but you clearly meant $\cos(K)=5 \text{ sinc}(5.12\sqrt{E}) + \cos(5.12\sqrt{E})$ Second, ...
• 1,253
Accepted

### Matlab struct vector

You can do something like this in Matlab: N = 1e4; c = []; c.x = [0 1]; c(1:N) = c;
• 4,258
Accepted

### Plot 2D piecewise constant in matlab in a finite elements mesh

I use typically the following approach. The idea is to make a new mesh where every vertex is duplicated so that each triangle has its own copy. Then you can use standard trisurf command to the ...
• 2,104

### BLAS libraries for Octave or Matlab, preferrably with GPU support?

MATLAB already comes with Intel MKL for its BLAS implementation. There's no reason to replace that. As for using GPUs, if you make your array a gpuArray (to do ...
• 12.3k

### How do I check if a value my function returns is a multiple of 180?

modulo operation is the cleanest, you could then compare the output of the modulo operator to see if it's less than your threshold for "very close"
• 414

### Good IDE for GNU Octave?

QtOctave (source1, source2) among many others like OctaveOnline, Jupyter Notebook, Emacs, Sublime Text, VS Code, etc. support Octave code editing, syntax highlighting, and more. ...
Accepted

### How can I find the current for a nonlinear electrical circuit using the Shockley equation, in Octave?

The easiest way is to create a lambda function at call time which lets you set "extra" arguments. You can then call this in a for loop and vary the extra argument. ...
• 2,794

### eigs routine in octave

As per the submitted bug report, there was a bug in ARPACK < 3.1.5 regarding dneupd, the subroutine that "returns the ...
• 8,672

### Is it possible to use Octave to learn MATLAB programming?

The best free language which has MATLAB-like syntax is Julia. It's also faster and has a more extensive package system (among other reasons why it's better...), but the linear algebra syntax is almost ...
• 12.3k

### Minimizing vector norm without using symbolic packages

You shouldn't be using symbolic package for this task. Also your usage of ones is going to produce n-by-n matrix of ones - which is not what you intended. Given the ...
• 2,781
Accepted

### How to vectorize 2 nested for loop with one complex condition in the inner loop?

rmid = 0.5*(r_int + r_ot); rlen = 0.5*(r_ot - r_int); cc = double(abs(circ - rmid) <= rlen);
• 617

### Solve discontinuous ODE with lsode

If you speak of discontinuous ODE, one would think of a discontinuous right side function. If the discontinuity is only a jump, and only depends on time, then using the ...
• 6,109

### (Lack of) Availability of Finite-Difference library for simple 2D PDEs

I know this is a little bit late, but there's a third party library in Python which solve PDEs using FD, it is called findiff. Check it out.

### (Lack of) Availability of Finite-Difference library for simple 2D PDEs

It seems hard to write a general enough FD library thas has wide applicability, since FD methods are not as easy to write for general domains, unlike FEM which uses unstructured grids, for which there ...
• 3,028
1 vote

### GNU Octave: using 'parallel' with an array (apply function to each array member)

I can not reproduce the error. Here is the snippet I am using: ...
• 2,781
1 vote

### Rem function in Octave showing wrong result

$0.1$ is not exactly representable in double precision arithmetic, and it will be rounded. The double precision representation of $0.1$ is \$\verb|00111111 10111001 10011001 10011001 10011001 10011001 ...
• 2,781
1 vote
Accepted

### Plotting two data sets in Octave

Use plot(x,[y1;y2]) but make sure that y2 is of the same size as y1, because in your example that isn't the case.
• 725
1 vote

### surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X) in octave

Double-check the documentation of mesh. temp3 must be a matrix of size length(temp1) x ...
• 11.5k

Only top scored, non community-wiki answers of a minimum length are eligible