Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
2answers
29 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 ...
1
vote
1answer
35 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 ...
0
votes
0answers
76 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& -...
0
votes
2answers
34 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 ...
0
votes
0answers
23 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
0answers
25 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
1answer
65 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:...
0
votes
0answers
57 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 ...
0
votes
0answers
30 views

phase portrait of a Lotka-Volterra competitive model with two species in octave

I need to make a phase portrait of a Lotka-Volterra competitive model with two species in GNU octave and I do not know how to do it. I manage to get to made the vector field. But I do not know how ...
0
votes
1answer
39 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
1answer
45 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 ...
2
votes
1answer
70 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 ...
0
votes
0answers
108 views

Univariate Linear Regression in Octave

I am studying Andrew Ng's course on machine learning and I having a bit of a challenge getting my gradient descent algorithm to work properly. I have a data set that shows the head size for and their ...
0
votes
1answer
50 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
vote
1answer
700 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$...$...
2
votes
1answer
76 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 ...
1
vote
2answers
60 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
0answers
26 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 ...
1
vote
0answers
63 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 ...
0
votes
2answers
53 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 ...
1
vote
1answer
266 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: ...
1
vote
2answers
155 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
0answers
32 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,...
1
vote
0answers
139 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 ...
1
vote
1answer
140 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 ...
0
votes
1answer
308 views

Modulo operations in octave

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 ...
1
vote
1answer
84 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 ...
0
votes
0answers
55 views

Octave matrix to image pixels too small (do not have 1 pixel per integer)

I am working on a project which plots points over a checkerboard (representing seats for people). I would like each pixel in the image to represent each integer matrix entry. After updating my ...
2
votes
1answer
114 views

Find the complex roots of $4x^2+16$ using QR method

$$p(x)=4x^2+16$$ $$m(x)=\frac{p(x)}{4}=x^2+4$$ Now, I can determine the Companion matrix of $x^2+4$: $$A=A_1=\begin{pmatrix} 0 \ -4 \\ 1 \ \ \ \ \ \ 0 \end{pmatrix}$$ QR decomposition (using Octave)...
0
votes
0answers
269 views

Writing a script to generarte m random outcomes of a Binomial Random Variable

I am brand new to Octave and am trying to become familiar with writing code to simulate random events. How could I write a script that generates $m$ outcomes ffrom the CDF of a binomial random ...
1
vote
1answer
101 views

Interpolation of $\frac{1}{1+x^2}$ on Octave

I have used Chebyshev nodes to avoid Runge's phenomenon ...
1
vote
2answers
147 views

Dimension 1 and dimension 2 in octave

I have this in octave: ...
1
vote
0answers
117 views

Calculating non-orthonormal null spaces

I am trying to calculate the null space of a binary matrix (GF(2)), but I don't want it to be orthonormal. For instance, if you ask Wolfram|Alpha to calculate the null space of the following matrix: \...
-1
votes
1answer
118 views

Algebra - Vector Spaces - Analytic Geometry - Octave

I'm studying for my algebra exam and I'm having problem solving these two simple True or False problems. It is a practice exam and I'm using Octave to solve them. For the second exercise I think I ...
-2
votes
1answer
56 views

How to calculate values after scaling numbers. [closed]

I have two number list old scale and the new scale. What formula would I use to find the new scale value if the old scale value is 5.89345? Is it possible to ...
1
vote
1answer
76 views

Find all k-tuples of (strictly) monotonically increasing numbers

Topic might be missleading so here's what I want to achieve in Oactave/Matlab (result preferably row-wise in a matrix): Let $\lambda=(\lambda_1,\ldots,\lambda_k)\in\mathbb{N}^k_{\geq0}$. So I want ...
0
votes
1answer
57 views

Comparing $f(x)$ and the $f\_approx(x)$ in Matlab, Octave or Mathematica/Wolfram

I have a function $f(x)$ and I wrote the approximation for $f(x)$ as $f\_approx(x)$ which is a simple algebraic formula with sums and products . I now want to study the 2 functions side by side and ...
2
votes
3answers
206 views

Problem of Linear Programming, Scilab or Octave

I have to solve this with Octave or Scilab. There's an airplane company with airplanes flying to 3 different destinations (London, Paris, Rome). Schedule of flights ...
0
votes
1answer
141 views

MATLAB: how to include running time on a graph? [closed]

I have a MATLAB/Octave program for which I used the tic and toc functions to measure the time elapsed for some calculations. e.g....
0
votes
1answer
7k views

machine learning octave code gradient descent question

I'm taking Coursera Machine learning course. so who take this courses will able to help this problem. this is the octave code to find the delta for gradient descent. ...
2
votes
1answer
1k views

How do I plot this graph in octave?

Trying to plot this graph in octave, do anyone know how to do it? I do not know how to do it when it is equal to 0. $r^{3}(1 + \frac{0.00822}{101325 * r}) - r(\frac{6 \pi * (16.7 * 10^{-6}) * (1.6666 ...
0
votes
1answer
384 views

Octave false position

i'm try to write some code in octave based in false position method. So, here it is: And I get the follow error: "parse error near line 40 of file C:\Users\HP...falsa.m syntax error else" So, ...
2
votes
3answers
969 views

The decision boundary found by your classifier?

Can someone please explain in terms of "How To" find the decision boundary found by your classifier? If I plot using Octave: plot(theta); I get nothing like I ...
0
votes
0answers
91 views

Histogram: What is wrong with this code?

I've got some issues while trying to plot an histogram using Octave, in order to compare it with a p.d.f. given. 1) First of all, I can't find the best way to make an histogram with the frequencies ...
1
vote
1answer
604 views

chebyshev nodes - formula for general interval [closed]

Could you help me write elegant form of formula for Chebysev nodes in $[a,b]$ ? Size of vector of points is $n$. I am working with octave, but the most important thing is: How to formulate it clear ...
1
vote
1answer
142 views

Octave - Why $0.6-0.2-0.2-0.2 \neq 0$, but $0.4-0.2-0.2 = 0$?

I am newbie about this subject. I have no idea, why: $$\text{octave}: 0.6 - 0.2 - 0.2 - 0.2$$ $$\text{ans}= -5.55111512312578\times 10^{-17}$$ It should be $0$. However in case: $$\...
0
votes
1answer
674 views

Finding value of (y) of logarithmic equation given (x)

I have an logarithmic equation $$\left[ r=a\,e^{b\,\theta} \right] $$ And I plot it to visualise it (see plot below). I can tell by the plot when (t=0), x1=0, y=1 (point AA) but how can I find out ...
0
votes
1answer
353 views

Converting equation into Octave / Matlab code and a for loop

I have an array of thousands of values I've only included three groupings as an example below: (amp1=0.2; freq1=3; phase1=1; is an example of one grouping) ...
0
votes
1answer
878 views

How can I find the value of y given x using matlab / octave

I have two points on a plot point1=(40,5) and point2=(50,1) How can I find the value of y given x=42.5 I know y is 4 by looking at the plot but is there away to calculate the y value directly. I ...
1
vote
3answers
87 views

Finding when list of numbers reach periodicity given known values

I'm trying to figure out when numbers reach "periodicity" given known values. I've included an example below with image: I have known sizes (100, 75, and 50) that I would like to know how many times ...