Questions tagged [octave]

For mathematical questions about Octave; questions purely about the language, syntax, or runtime errors would likely be better received on Stack Overflow. Octave is a high-level interpreted language for numerical computations. Use either the (octave) tag or the (matlab) tag, unless your question involves both packages.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

compute direction of field lines in space of the following vectorfields

i have a hard time to break down these equations and sketch the vector fields. I dont know much math but i really want to solve these and plot them in Octave or Matlab. These quastions are from an ...
-2 votes
1 answer
41 views

How to make program for five realizations of ito process X = exp(t + 0.2W(t)) [closed]

I want to plot the following figures in octave. I prepared the following program to plot one realization of ito process X =exp(t + 0.2W(t)) where W(t) is a Wiener process= $ \displaystyle\sum_{j=0}^{\...
1 vote
0 answers
46 views

Precision in numerical methods using Octave

I have created an algorithm for the bisection method using Octave and tested it on two different functions. The fist one worked flawlessly within the required tolerance. The second, however, won't ...
  • 43
0 votes
0 answers
123 views

fsolve problem in Matlab and Octave

Is there some configuration of tolerances that can be done to get rid of the following in Octave: ...
0 votes
0 answers
244 views

How to use heaviside function in Octave/Matlab?

I am just trying to plot a simple function. Why doesn't it work? In Octave it says "syntax error" and points to the plot(x,y). Matlab complains about unbalanced parenthesis. ...
1 vote
1 answer
54 views

Finding $x$ from $Ax = b$ with $QR$ factorization

I'm currently trying to find $x$ such as $A x = b$ where $A \in \mathbb{R}^{5\times 5}$, $x \in \mathbb{R}^{5}$ and $b \in \mathbb{R}^{5}$. I used for that the $QR$ factorisation. I know I have the ...
0 votes
0 answers
38 views

Algorithm that solves a system of linear equations over finite fields when a parameter is needed

I was reading Kipnis' and Shamir's paper on Cryptanalysis of the HFE Public Key Cryptosystem by Relinearisation and I wanted to implement the example at the end in Octave without using any additional ...
  • 15
0 votes
1 answer
117 views

Problem in Octave code of impulsive differential equations?

In the image, I have written about the impulsive differential equation. I want to code the solution in Octave with Runge-Kutta 4th order method: I have tried it. But I am not able to code the ...
1 vote
0 answers
416 views

How to use Octave with real numbers and syms at one time

I want to use GNU Octave to solve my equations. Equations contain syms variables and vectors with decimal numbers in them. How properly solve these equations without getting warnings that im doing ...
-1 votes
1 answer
382 views

Trying to create a 3D model of Kelvin’s Tetradecahedron / Tetrakaidecahedron polyhedra

How can I go about creating a 3D model / 3D image of a Kelvin’s Tetrakaidecahedron Cell / Tetrakaidecahedron. I planned on using Octave to 3D model an image it mathematically then convert that into a ...
  • 415
2 votes
1 answer
123 views

Plot in Octave of Integral on unit circle $\int_{-\pi}^\pi \frac{(1-r^2)\cos(x)}{1-2r \cos(\theta-x)+r^2}dx $

i want to get a 3D Plot in Octave of the function $$f(r\cdot e^{i\theta})=\int_{-\pi}^\pi \frac{(1-r^2)\cdot\cos(x)}{1-2\cdot r\cdot\cos(\theta-x)+r^2}dx $$ what is called the Poisson-Integral for the ...
0 votes
1 answer
139 views

Why can one make a second-order ODE to first-order for ode45?

Why can one make a second-order ODE to first-order for ode45? Such as in these examples: https://www.sharetechnote.com/html/Octave_Matlab_DifferentialEquation.html E.g. $$m \frac{d^2x}{dt^2}+kx=0$$ ...
  • 7,042
-1 votes
1 answer
134 views

Can GNU Octave be used to solve a linear equation?

I want to solve a linear equation of the form ax+by= gcd(a,b) On paper, I would solve it using the Euclidean algorithm steps. Is there a way to solve this using GNU ...
  • 422
4 votes
1 answer
409 views

3D Parametric Equation changing over time

I can create a 3D Parametric Equation of a spiral but I'm having trouble getting the angle of "decent" to also change over time. $$x=u\sin(u)\cos(v)$$ $$y=u\cos(u)\cos(v)$$ $$z=-u\sin(v)$$ ...
  • 415
1 vote
1 answer
1k views

Inverse matrix to a bi-diagonal matrix

I need to find an inverse matrix to a bi-diagonal matrix $A$. I know that I can use "inv(A)" but it isn't a good point. Is there any algorithm that can count it easily?
0 votes
1 answer
38 views

Find an approximation of $f(x) = \frac{1}{(\pi-\cos^{-1}(x))}$ in certain range

$$f(x) = \frac{1}{(\pi-\cos^{-1}(x))}$$ is very steep and hard to approximate near $1/-1$ points. I need to have an approximation in the range -1...0.7, (not full -1..1). This smaller area allows ...
0 votes
1 answer
104 views

Difference Between Matlab / Octave Solve and Numpy Solve

I am trying to solve a linear system on Python for a problem which I ported from Octave. I have the following code for Octave ...
  • 15.5k
0 votes
1 answer
199 views

Ratio of successive errors does not converge to $2^{-p}$.

Assume a multistep method with order $p$. Then for the global error we have: $$ \| y_{n+1} - y(x_{n+1}) \| = O(h^p) \leq K h^p $$ Given the above, if we divide the step $h$ by $2$, then $$ \frac{...
  • 2,011
1 vote
1 answer
338 views

Bdf3 Method no convergence

I try to implement the Backward differentiation formula 3 (BDF3) on Octave and the plot shows no convergence. Here's my attemp. For the first 4 steps I use the rk4 method and since bdf3 is an indirect ...
  • 63
0 votes
2 answers
238 views

Calculating at what time and at what angle two objects will cross around a circle

I'm trying to calculate the times and the angles (the red 'X') at which two objects 'A' (the blue dot) and 'B' (the red dot) that are travelling around a circle and start at different speeds and ...
  • 415
0 votes
1 answer
34 views

OCTAVE/MATLAB Creating script with vectors

I need to make a script file on Octave where, when given an input variable VEC1 and INC (where VEC1 is a vector of floating point numbers and INC is a single integer), a subvector of VEC1 is produced. ...
0 votes
1 answer
64 views

Applying Restraints in Octave while Plotting a Graph

I am plotting a graph using Octave. I am trying to plot the graph of the following function: $$y = \ln|\sin x| $$ Where Following Constraints Exist: $$ 0 \le x \le 22 \land -2 \le y \le 0$$ I know ...
0 votes
1 answer
34 views

Newton method non-linear systems envolving curves

I have to solve the following system: $$ x'(t) \times y'(s) = 0 $$ $$ (y(s) - x(t)) \times y'(s) = 0 $$ Where: $$ x(t) = (cos(t), sin(t)) $$ $$ y(s) = (s, s^2) $$ using Newton's method for non-...
  • 3
0 votes
0 answers
24 views

How exactly to interpret the output of this MatLab\Octave function calculating the value of a sigmoid function?

I am studying a ML course on Coursera and I am pulling out some old linear algebra concept that I am not using since the time of university. I have some doubts. I have this MatLab\Octave function ...
2 votes
1 answer
82 views

Octave coding - How many vectors rotated by an angle is within the distance of another vector

I don't know if this is the right forum but I am trying to code a rotating vector v by an angle theta anticlockwise ...
  • 187
0 votes
2 answers
1k views

Converting system from continuous time to discrete time with restricted time?

I need to find a discrete system that has the exact same states and output at $t=0.1k$, with $k \in I$, as the following continuous time system: I'm mostly confused about what to put for the sampling ...
2 votes
1 answer
1k views

Doubt about how exactly was calculated this gradient descent cost function using Octave\MatLab. How is it exactly working?

I am following a machine learning course on Coursera and I am doing the following exercise using Octave (MatLab should be the same). The excercise is related to the calculation of the cost function ...
2 votes
1 answer
286 views

How do I complete the steps of finding the Jordan of this $5\times 5$ matrix (with Octave)?

I know how to begin the procedure but I don't know how to finish it. Let's start with an example (sorry for it being so unwieldy). Let $$A =\begin{pmatrix} 177& 548& 271& -548& -...
  • 1,808
0 votes
2 answers
748 views

Division between scalar and matrix in octave

I am using octave and when I am writing this: 1/[1;2;3] It returns the result as this: ans = 0.071429 0.142857 0.214286 ...
  • 151
0 votes
0 answers
50 views

Convert Real and Imaginary part from FFT to bands

how can I convert real and imaginary part from FFT to octave bands? I know how to do it for Absolute value, but dont know for Re, Im parts. Thanks
1 vote
1 answer
135 views

Understanding singular value decomposition example

I wanted to view SVD in action (using Octave) by running it on an image and then breaking it down into a set of rank 1 matrices. I'm getting stuck before that though, because I'm unable to reproduce ...
0 votes
1 answer
269 views

Implement recursive definition and closed form in octave

I want to find $I_n := \int_{0}^{1} x^n e^x dx$ with numerical methods. I have found the recurrence relation $I_n = e - n \cdot I_{n - 1}$ and the closed form \begin{align} \tag{$\star$} \label{eq:...
  • 4,426
0 votes
0 answers
905 views

Solve 2 equations in 2 unknowns in octave?

I have the following 2 equations in 2 unknowns $(x,t)$: $(t*x-20)^4 = 100*((t*x-20)^2-t^2(150^2-x^2)) $ $(t*\sqrt{(150^2-x^2)}+70) = ((t*x)+30)*tan(arctan(7/3)+36*t)$ I tried solving them ...
  • 180
1 vote
1 answer
172 views

Average size of dot products, Textbook problem

This problem comes from Gilbert Strang's Linear Algebra 5th Edition pg 21, problem 34: "Using v=randn(3,1) in MATLAB, create a random unit vector u= v / ||v||. Using V = randn(3,30) create 30 more ...
1 vote
1 answer
2k views

Computing the condition number of a matrix

Given$$A=\begin{bmatrix}23.89&-36.48&1.432&21.65\\-36.48&54.58&-5.193&-34.45\\1.432&-5.193&-1.0717&1.937\\21.65&-34.45&1.937&20.50\end{bmatrix}.$$ I am ...
  • 965
2 votes
1 answer
535 views

LU Decomposition: difference between between hand calculation and solver?

I have a $3 \times 3$ matrix $A$ and have to perform the $LU$ Factorization (1) $$ A = \begin{bmatrix} 1 & 2 & 3 \\ 1 & -1 & 3 \\ -2 & -10 & -2 \end{bmatrix}$$ Using row ...
  • 965
1 vote
1 answer
343 views

Stable way to find QR-decomposition

How to compute the QR decomposition of matrix \begin{bmatrix} v^T \\ QR \end{bmatrix} in a stable way, where $QR$ represent the product of a real orthogonal matrix $Q \in \Bbb R^{m \times n}$ and ...
  • 1,784
2 votes
1 answer
5k views

How to make "sigma" summation of a function by i variable in GNU Octave?

I need to make summation using function of a variable i like this: \begin{equation} \sum_{i=1}^5\left(|x_{i}| - |37-x_i|\right) \end{equation} In Maxima it is done like this (ar - array of $x_1$...$...
  • 403
2 votes
1 answer
384 views

System identification of a resonant system

I want to write a matlab script that would identify a system from it's inputs and outputs. I have so far had good results with simple systems, but with this slightly more complex one I'm not able to ...
  • 153
1 vote
2 answers
2k views

Linear Algebra: Residual $A x - b$

I'm doing a course on Applied Linear Algebra. Which, for the most part, is about applications in Octave, so there isn't much about the happenings behind a lot of the mechanics of everything. I'm ...
1 vote
0 answers
30 views

Why does the multiplication in a division algebra depends on every component?

In a division algebra A over $\mathbb{R}$ we have this multiplication (A isomorphic to $\mathbb{R}^{n}$) $$\mathbb{R}^{n} \times \mathbb{R}^{n} \to \mathbb{R}^{n}:(x,y)\mapsto y=x\cdot y$$ where every ...
  • 45
1 vote
0 answers
145 views

Error calculating diffusion equation solution by fft

I''m trying to compute the solutions of: $$\partial_tu=\partial_{xx}u$$ with $x\in[0,1]$ and initial conditions$$u(0,x)=sin(\pi x) $$ Solution are periodic. We have to apply forward euler in time and ...
  • 325
0 votes
2 answers
392 views

Octave tf2ss: no way to build a system with multiple outputs?

The function in octave tf2ss is supposed to build a state space representation of a system. What I don't understand is how to make it produce a system that has a NxN C matrix, ie a system that outputs ...
  • 153
1 vote
1 answer
2k views

Conversion from state space back to transfer function in octave.

I'm having problem converting a transfer function to state space and then going back to the same transfer function. I did a little experiment: ...
  • 153
1 vote
2 answers
329 views

What does adding between dimensions mean if anything at all? Are there useful conventions for doing so? [closed]

Conceptually, why is adding a scalar to a matrix defined ins some cases when adding matrices of different dimensions does not seem to make sense? What does it mean to add a dot to a line, or a line ...
0 votes
0 answers
41 views

Find solutions for multivariable mutliplicative group equation

I have put the following into wolframalpha.com $$ 11 \equiv x* \left(y^{119}\right)^{149} \pmod{151} $$ It is giving me a set of solutions back. Is it just iterating over all the values of x and y,...
  • 155
1 vote
0 answers
370 views

DFT implementation: relationship between number of samples and resolution of frequency

I come from an engineer background and I am sorry that this got so long. If $f(t)$ is a continuous signal, let $f[k]$ be the discretized signal for a timerange $T$ between two samples with for ...
  • 11
1 vote
1 answer
227 views

Calculating correct slope for pitch shifting given starting resonance frequency and ending frequency

How can I calculate the correct slope for variable fac (which controls how much a signal is gradually pitch shifted), if I wanted to end at a certain frequency? An ...
  • 415
0 votes
1 answer
932 views

Modulo operations in octave [closed]

I have to calculate mod$(2^{1000-k},8k+1)$ (k≤50)with octave. How can I do that? $2^{1000}$ is too big... I think I can split the modulo operation but the code becomes heavy. Is there a way to set ...
user avatar
1 vote
1 answer
112 views

Find command in matlab [closed]

If I have i=find(10==[11 15 10 -7]) then i=3. But in the case i=find(10==[11 15 11 -7]) then "ind=[](1x0)" I neet to use ...
  • 784