# Questions tagged [octave]

Octave is a scientific programming & scripting language with syntax similar to MATLAB and SCILAB.

51 questions
Filter by
Sorted by
Tagged with
44 views

### Loop Code for Probability Distributions

I'm trying to create a loop for a probability distribution. My initial condition is $p_0 = (1, 0, 0, 0, 0)$, $T$ = [0 1/3 1/3 1/3 0; 1/2 0 1/2 0 0; 1/3 1/3 0 1/3 0; 1/3 0 1/3 0 1/3; 0 0 0 1 0], (T is ...
65 views

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

For this electrical circuit: The voltage $V_D$ can be found by solving a nonlinear equation: $$\frac{V_{DD}}{R} - \frac{V_D}{R} - I_se^{V_D/V_T} = 0$$ In this example, let $R=1000$, $V_T = 0.025$,...
312 views

### Good IDE for GNU Octave?

Are there any good IDEs for working with Octave code? I'm used to type hints and documentation preview from software like IntelliJ or VS Code. While there are syntax highlighting plugins for VSC, all ...
64 views

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

I need to write a for loop that tests multiple values in a function until the output is a multiple of 180. i.e. it starts the number i'm testing at zero, checks if the result is a multiple of 180 or ...
• 1
120 views

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

I want help with my Octave code regarding the unsteady heat equation. My geometry and mesh are generated with FreeFEM++, so there is no problem with that (I tried it with the steady problem with no ...
137 views

### Solve discontinuous ODE with lsode

I am trying to solve a discontinuous ODE using the lsode solver. I tried setting the t_crit parameter to specify the time where the discontinuity is present, but it ...
• 101
64 views

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

I would like to solve a set of coupled second order differential equations using inbuilt Matlab/Octave subroutines. These equations arise when trying to model sliding of mass ($m_2$) over a wedge of ...
163 views

### How to implement large rotations in total lagrangian formulation (nonlinear FEM)?

I have developed an Octave script to solve the nonlinear Euler-Bernoulli beam equations with linearized von Karman-strains, i.e. higher-order terms are dropped. The simulation results agree with ...
• 31
399 views

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

Given a large sparse (square) matrix in MATLAB, how can I extract the banded or the block-diagonal parts (of fixed size) of it efficiently? These are useful operations when prototyping and testing ...
• 2,411
662 views

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

I am new to GNU Octave 6.2.0 on Linux, and I am trying to use the package 'parallel' to make use of 24 threads on my machine. I have an array (array1) that has ...
140 views

### Rem function in Octave showing wrong result

I am trying to write an if statement that checks if 2 numbers are divisible before running some commands. The problem is, the rem function is giving some wrong results for certain number (2 is ...
• 11
1 vote
321 views

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

I would like to solve two types of simple 2D problems, namely the stationary heat equation on an L shaped geometry like this: And also compute the magnetostactic field in an air gap of the following ...
• 560
121 views

### Plotting two data sets in Octave

I have two data vectors $y1$ and $y2$, and I want to plot both of them as functions of the vector $x$. I want the result to be two overlapping curves. Here is the set of commands I am using. y2=[0.003,...
• 101
1 vote
1k views

291 views

### Nice plot of f(x)

A user has this nice graph of f(x) on his profile and I want to learn how to do it in matlab or Gnu octave. ...
1 vote
135 views

### Applying a weighting function which is sampled at different points

I have a set of data to which I want to apply a weighting function, so basically a simple multiplication. My sampled data looks like this: (for those interested, it's the relative luminous intensity ...
• 111
1 vote
58 views

### Software to simulate behavioral economic models?

I am looking for a way to simulate behavioral economic models to illustrate the effects of changing parameters. I am familiar with statistical analysis (especially R), but I only have few programming ...
765 views

### eigs routine in octave [closed]

I am using octave and observed a problem with the eigs-routine for non symmetric matrices. Using GNU octave version 3.8.1 the code below gives significant difference of eigenvalues although same ...
• 297
1 vote
2k views

### Solve poisson equation with Neumann b.c. (matlab or octave)

I'm trying to reconstruct an image given its Laplacian, which results in a Poisson equation and I'm using Neumann boundary conditions (derivative at boundary = 0). What I have is the laplacian (f, ...
• 111
18k views

### Alternatives to Comsol Multiphysics

This might be a question better suited for the Software Recommendations side of S.E., however I do believe that people who frequent this part of S.E. are more likely to be able to answer this question....
• 255
2k views

### Partial differential equations with octave [closed]

I need to find a numerical solution for $-\Delta U = f$, on the $\Omega = [0,1]^2$, with $U|_{\partial \Omega} = 0$. I found a method: POISSONFD in ...
1 vote
253 views

### Printing a plot in Octave-3.8.1 breaks LaTeX labels [closed]

Since upgrading to Octave 3.8 I have been unable to export plots with LaTeX labels. When the figure is displayed the labels render fine but when I try to export the figure using the ...
• 11
196 views

### Solve chemical formula (number of molecules in reaction)

In order to balance atom count in chemical equation: a O2 + b C12H24O11 → c CO2 + d H2O I make linear equation: ...
• 121
1 vote
4k views

### Polar axes in Octave?

if i draw a polar plot with Octave the axes are cartessian, not polar axes. But in Matlab it seems polar axes exists for polar plots. Is there anyway to draw with polar axes in polar plots in Octave? ...
• 133
331 views

### quiver3 gives non-conformant arguments?

Does anyone know why I'm seeing these errors? I'm not giving it a matrix. ...
• 101
34k views

### Euclidean distance in Octave

I would like to know if there is a quick way to compute the Euclidean distance of two vectors in Octave. It seems that there is no special function for that, so should I just use the formula with <...
• 301
1 vote
2k views

### How can I get Octave to correctly compute a double integral of a piecewise function?

Computational Science People: The title is the question. I am trying to numerically compute a certain integral over a square in Octave (an open-source Matlab clone). I'm getting the wrong answer. ...
• 515
5k views

### Octave 3D mesh, data from file

I have a big file with 3 columns: density, dimension, value. example: 10 0.3 200 10 0.4 300 20 0.3 250 20 0.4 320 ... I am trying to draw a 3d plot - ...
• 49
5k views

### fmincg implementation in Python

I'm trying to re-implement Neural Networks in Python. I implemented the cost function and the backpropagation algorithm correctly. I have checked them by executing its Octave equivalent code. But ...
• 223
4k views

### Plotting x,y coordinates and vectors with octave

I have a data set containing the recorded data from a car's motion (latitude,longitude, and heading). I'd like to plot the (lat,lon) points on a 2D plot with a unit vector pointing in the direction ...
• 153
2k views

### Python syntax for MATLAB/Octave colon operator a:dx:b

I am trying to rewrite some MATLAB/Octave code in Python, and I don't know what would be the nicest or most intuitive way of writing ...
• 1,185
475 views

### In Octave, how do I specify that the solution to a matrix equation should be over integers?

In Octave, how do I specify that the solution to a matrix equation should be over integers? I.e., Given matrix $A$, vectors $x$ and $b$; $Ax=b$. Find vector $x=A^{-1}b$ such that all its entries are ...
• 121